<resources> <string name="hello"><u>phone: 1390123456</u></string> <string name="app_name">MyLink</string> </resources>如果是代码这样写.
textView.setText(Html.fromHtml("<u>"+"hahaha"+"</u>"));
二、文字变红:
String x="imp";
text.setText(Html.fromHtml("<font color=\"#ff0000\">"+x));
1、代码中增加。
TextView textView = (TextView)findViewById(R.id.myTextView);
Linkify.addLinks(textView, Linkify.WEB_URLS|Linkify.EMAIL_ADDRESSES);
如果想让显示超链接的形式,但不能直接点击链接,增加android:linksClickable="false"
请注意,加上Linkify要在setText之后,否则不起作用。惨痛的教训。
2、xml中增加
<TextView android:id="@+id/text_view"
android:autoLink="all"
android:paddingTop="1dip"
android:paddingBottom="3dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:linksClickable="false"
android:text="http://www.csdn.net dsfdfsadasfasdf"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="18sp"
android:layout_gravity="left"
/>
四、
评论