小编Yen*_*Tay的帖子

Android TextView超链接

我正在使用包含两个超链接的字符串实现TextView,如下所示,但链接没有打开新的浏览器窗口:

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center"
        android:textColor="#ffffff"
        android:paddingLeft="50dp"
        android:paddingRight="50dp"
        android:textSize="14sp"
        android:clickable="true"
        android:linksClickable="true"
        android:textColorLink="@color/colorPrimary"
        android:autoLink="web"
        android:text="@string/agree_terms_privacy"/>
Run Code Online (Sandbox Code Playgroud)

在string.xml中

<string name="agree_terms_privacy">By continuing, you agree to our <a href="http://link1/terms">Terms of Use</a> and read the <a href="http://link1/privacy">Privacy Policy</a></string>
Run Code Online (Sandbox Code Playgroud)

android hyperlink textview

21
推荐指数
3
解决办法
3万
查看次数

标签 统计

android ×1

hyperlink ×1

textview ×1