为什么我不能使用"主题"覆盖tabSelectedTextColor。但"风格"工作良好?

时间:2015-10-31 14:27:02

标签: android

我的理解是使用" android:theme"与" style"相同除了它也适用于儿童观点。我不明白为什么会发生以下情况:

使用" android:theme":

    <android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:theme="@style/TabsLight"/>

我得到以下标签样式:

enter image description here

使用&#34; style&#34;代替:

<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    style="@style/TabsLight" />

我根据需要正确地在标签上显示白色字体颜色:

enter image description here

尽管在这两种情况下,我都映射到相同的样式:

<style name="TabsLight" parent="Widget.Design.TabLayout">
    <item name="tabTextAppearance">@style/TabsTextLight</item>
    <item name="tabSelectedTextColor">#ffffff</item>
 </style>

<style name="TabsTextLight" parent="TextAppearance.AppCompat.Button">
    <item name="android:textColor">#cccccc</item>
</style>

0 个答案:

没有答案