运行 一个简单的 link 与 android 中的 LinkMovementMethod

To run a simple link with LinkMovementMethod in android

如何使用以下命令运行一个简单的link?

<TextView
    android:text="text"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/textView1" />


TextView textView = FindViewById<TextView>(Resource.Id.textView1); 
textView.TextFormatted = Android.Text.Html.FromHtml("https://www.google.com"); 
textView.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance;

这些工作:

   textView.TextFormatted = Android.Text.Html.FromHtml("<a href=\"" + "https://www.google.com" + "\">google</a>");
       textView.TextFormatted = Android.Text.Html.FromHtml("<a href=\"" + "https://www.google.com" + "\">https://www.google.com</a>");

这也不行:

<TextView
    android:text="text"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:id="@+id/textView1" />

 textView.TextFormatted = Android.Text.Html.FromHtml("<u>" + "https://www.google.com" + "</u>");

LinkMovementMethod 仅适用于文本中的链接。

在Html中,<a>表示指向url的超链接,但<u>不是超链接,它只是一个下划线。

避免使用可能与超链接混淆的元素。