我正在尝试在操作栏中更改字幕的颜色,但它没有改变。
这是屏幕截图。
这是styles.xml
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:subtitleTextStyle">@style/MyActionBar.TitleTextStyle</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/actionbarBackground</item>
<item name="android:tabStripEnabled">true</item>
<item name="backgroundSplit">@color/white</item>
</style>
<style name="MyActionBar.TitleTextStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle">
<item name="android:textColor">@color/white</item>
</style>
最佳答案
android:subtitleTextStyle
属性是Widget.ActionBar
的继承。您需要将其移至您的MyActionBar
样式,而不是根主题。
另外,不要忘记添加支持库兼容性,因为您正在使用AppCompat:
<style name="MyActionBar" parent="android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
...
<item name="android:subtitleTextStyle">@style/MyActionBar.TitleTextStyle</item>
<!-- Support library compatibility -->
<item name="subtitleTextStyle">@style/MyActionBar.TitleTextStyle</item>
</style>