Goal: Have a word in the middle of a sentence be a hyperlink that opens the website in a browser
What's happening: It looks like a hyperlink, but nothing happens when I click
What I've tried:
- I tried making it an intent, that worked to make it clickable, but it made the entire sentence clickable.
- Also, I then switched to using the Html.FromHtml method.
C#:
string Content = "<span>Please navigate to <a href='https://www.website.com'>HERE</a> to register</span>";
lblTESTSystem.TextFormatted = Html.FromHtml(Content); //lblTESTSystem.SetText(Html.FromHtml(Content, FromHtmlOptions.ModeLegacy), TextView.BufferType.Spannable);
What the above code looks like:
Alternate/first C# code that made entire sentence clickable:
//lblTESTSystem.Click += (sender, eventArgs) =>
//{
// var uri = Android.Net.Uri.Parse("https://www.website.com");
// var intent = new Intent(Intent.ActionView, uri);
// StartActivity(intent);
//};

You can add the
WebViewin the xaml page then bind ahtml fileto theWebView.source.In the MainPage.xaml, you can add the code to the target page.
In the MainPage.xaml.cs
Then Create the
name.html filein the target file package.