【发布时间】:2017-11-07 08:52:28
【问题描述】:
我有一个视图显示 textview 并启用自动链接。
<TextView
android:id="@+id/txt_contents"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="30dp"
android:textColor="@color/txt_code_itemlist"
android:autoLink="web"
android:textSize="22sp" />
现在,当我单击 textview 中的链接时,它将打开浏览器。但是当我点击相同的链接时,我想找到打开新活动的方法。
【问题讨论】:
-
在 textview 上实现 onclick 监听器
-
@JaydeepPatel 我只想在 http 链接上启用点击操作。
-
检查文本是否为url:URLUtil.isValidUrl(url)
-
@Goffity 你找到解决方案了吗?
标签: android hyperlink textview