【发布时间】:2013-03-08 16:49:08
【问题描述】:
我有一个 TextView,我用一个由一些 HTML 制成的 Spannable 填充。
这段代码:
textView.setText(Html.fromHtml(textContent, mImageGetter, null));
显示链接,但它们不可点击。这段代码:
text.setMovementMethod(LinkMovementMethod.getInstance());
textView.setText(Html.fromHtml(textContent, mImageGetter, null));
不显示链接。 TextView 在 XML 中指定为
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/another_textview"
android:layout_marginTop="5dp"
android:autoLink="web"
android:textColorLink="@color/link_color_unpressed"
android:textColor="#ffffff"
android:textSize="18sp" />
为什么LinkMovementMethod(一种完全存在的用于使TextView 中的链接可点击的方法)阻止链接显示?
【问题讨论】:
标签: android html textview spannable linkmovementmethod