我正在使用包含两个超链接的字符串实现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)