0

I would like to display a some text that when clicked will redirect me to a website. I am writing by android app with C# (Xamarian studio).

<TextView
        android:id="@+id/rsstitle"
        android:autoLink="web"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#FF7F3300"
        android:textSize="16dip"
        android:textStyle="bold" />

view.FindViewById<TextView> (Resource.Id.rsstitle).Text = values [position];
//values[position] contains a title string eg "Google"

links[position] contains a uri eg "https://www.google.co.nz/"

How do I make it so that "Google" is displayed but when clicked directs to https://www.google.co.nz/

0

1 Answer 1

2

Found my solution:

String linkText = "<a href=\"" + RSSActivity.links [position] + "\">" + values [position] + "</a> ";

link.TextFormatted = Html.FromHtml(linkText);
link.MovementMethod = LinkMovementMethod.Instance;
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.