问题描述
我有一个TextView
,其中显示了除链接之外的所有插入文本,但是仍应单击它们的位置,并将我带到所需的目的地。是什么使链接本身不可见?
来自字符串资源
<string name="credits">Video from <a href="http://youtube.com">Youtube</a></string>
来自布局
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/colorAccent"
android:fontFamily="@font/abril_fatface"
android:linespacingExtra="12sp"
android:paddingLeft="16dp"
android:paddingTop="75dp"
android:paddingRight="16dp"
android:text="@string/credits"
android:textAlignment="center"
android:textColor="@color/colorPrimaryDark"
android:textSize="30sp" />
来自活动
textCredits.movementMethod = LinkMovementMethod.getInstance()
解决方法
原因可能是文本颜色和背景相同。尝试使用以下方法为链接设置其他颜色:
android:textColorLink="@color/someColor"
,
使用这样的颜色
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned -Force
和
android:textColorLink="#fff"