【发布时间】:2013-09-05 10:38:02
【问题描述】:
我的 TextView 中有链接:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
...
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="all"
android:linksClickable="true"
android:text="@string/app_description" />
</RelativeLayout>
链接是资源的一部分:
<?xml version="1.0" encoding="utf-8"?>
<resources>
...
<string name="app_description">Some text with the <a href="http://www.example.com">link</a>.</string>
</resources>
不知何故链接不起作用。可能是什么原因? 它显示为链接。但是单击不会打开浏览器。
类代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
【问题讨论】:
-
你试过 android:clickable="true" 吗?
-
试试这个:android:autoLink="web"
-
@Hardy,谢谢,但这无济于事
标签: android hyperlink textview