在TextView里加上android:autoLink="all",那么正文中若有网址(http://),则可以显示出来。以下是个范例:
<TextView
android:id="@+id/myTextVeiw1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="all"
android:text="@string/url"
android:layout_x="61px"
android:layout_y="69px"
/>
<string name="url">http://eynjay.iteye.com</string>
<TextView
android:id="@+id/myTextVeiw1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="all"
android:text="@string/url"
android:layout_x="61px"
android:layout_y="69px"
/>
<string name="url">http://eynjay.iteye.com</string>
本文介绍如何在Android的TextView组件中设置属性android:autoLink=all来自动识别并高亮显示URL链接。通过示例代码展示了具体的实现方式。
2668

被折叠的 条评论
为什么被折叠?



