TextView中textAppearance属性无效

4

我将在TextView中展示链接文本。 起初,我的代码是这样的:

<TextView
     style="@style/informed_consent_check_TextView"
     android:id="@+id/accept_content_1"
     android:text="@string/informed_consent_accept"
     />


<style name="informed_consent_check_TextView" >
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:textSize">13dp</item>
    <item name="android:textColor">#fff</item>
    <item name="android:textColorLink">#fff000</item>
</style>

它运行良好。链接文本显示如下:

enter image description here

那就是我想要的。

然而,当我将关于文本的属性移动到样式中时,它就不起作用了。

<style name="informed_consent_content_textAppearance">
    <item name="android:textSize">13dp</item>
    <item name="android:textColor">#fff</item>
    <item name="android:textColorLink">#fff000</item>
</style>

<style name="informed_consent_check_TextView" >
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:textAppearance">@style/informed_consent_content_textAppearance</item>
</style>

链接文字显示的颜色错误: enter image description here 然后,我将textAppearance属性移动到TextView中。但是仍然有问题。
<TextView
     style="@style/informed_consent_check_TextView"
     android:id="@+id/accept_content_1"
     android:text="@string/informed_consent_accept"
     android:textAppearance="@style/@style/informed_consent_content_textAppearance"/>

我的设备是4.1.2版本。

谁能帮我。非常感谢。

1个回答

1

更改TextView属性

android:textAppearance = "@style/informed_consent_content_textAppearance"

谢谢。这是我的错误。我之前修改了代码。然而,问题仍然存在。 - Zebulon Li
将textColor更改为任何其他颜色,例如#ff0000,并在您的代码中编写两个时间样式。 - DjP
两次?你是指textAppearance吗?我把它从@style/informed_consent_check_TextView移动到TextView的xml中了。它仍然只出现一次。 - Zebulon Li

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接