我想更改此标签活动的字体颜色:
使用这种风格:
<style name="MyTheme" parent="MyTheme.Base"/>
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="drawerArrowStyle">@style/IconStyle</item>
<item name="android:actionBarTabTextStyle">@style/tabtextcolor</item>
</style>
<style name="IconStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@color/colorAccent</item>
</style>
<style name="tabtextcolor" parent="android:Widget.Holo.Light.ActionBar.TabText">
<item name="android:textColor">@color/colorAccent</item>
</style>
但标签文字颜色仍为白色。我在这里想念的是什么?谢谢。
答案 0 :(得分:1)
这是一个简单的解决方案。从主题中删除该样式。
<android.support.design.widget.TabLayout
....
app:tabTextColor="@color/your_color" />
答案 1 :(得分:1)
:
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
style="@style/AppTabLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/colorPrimary"
app:tabTextAppearance="@style/AppTabTextAppearance" /> //custom style for tab text
现在在你的
RES /值/样式:
<style name="AppTabLayout" parent="Widget.Design.TabLayout">
<item name="tabIndicatorColor">@color/colorAccent</item>
<item name="tabIndicatorHeight">4dp</item>
<item name="tabPaddingStart">6dp</item>
<item name="tabPaddingEnd">6dp</item>
<item name="tabTextAppearance">@style/AppTabTextAppearance</item>
<item name="tabSelectedTextColor">@color/color_white</item> //selected color
</style>
<!-- for text -->
<style name="AppTabTextAppearance" parent="TextAppearance.Design.Tab">
<item name="android:textSize">12sp</item>
<item name="android:textColor">@color/color_black</item> // default color
<item name="textAllCaps">false</item>
</style>