TextView链接文本不可见

问题描述

我有一个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"

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...