Dpe*_*nha 10 xamarin xamarin.forms
Xamarin中没有类似LinkButton的东西吗?
我想创建一个带有url链接外观的标签,一旦点击就会打开外部浏览器.
我还需要知道如何在便携式项目中打开设备的外部浏览器(打开指定的URL).
谢谢
Xamarin.Forms在默认移动浏览器中打开URL字符串的方法:
Device.OpenUri(new Uri("http://example.com"))
Run Code Online (Sandbox Code Playgroud)
虽然表单' Label没有点击事件,但您可以添加一个表单,TapGestureRecognizer当点击标签时它会执行Device.OpenUri.
var myURLLabel = new Label
{
Text = "https://xamarin.com"
};
myURLLabel.GestureRecognizers.Add(new TapGestureRecognizer
{
Command = new Command(() => {
Device.OpenUri(new Uri(myURLLabel.Text));
})
});
Run Code Online (Sandbox Code Playgroud)
Xamarin-Forms-Labs' ExtendedLabel允许您将标签的文本设置为带下划线的....
参考:https://github.com/XLabs/Xamarin-Forms-Labs/wiki/ExtendedLabel
| 归档时间: |
|
| 查看次数: |
8089 次 |
| 最近记录: |