【发布时间】:2017-07-08 15:39:40
【问题描述】:
我正在尝试像这样更改 ActionBar 文本颜色。
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="actionBarStyle">@style/MyTheme.ActionBarStyle</item>
</style>
<style name="MyTheme.ActionBarStyle" parent="@style/Widget.AppCompat.ActionBar">
<item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="MyTheme.ActionBar.TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/white</item>
</style>
根据很多similar topics (another one) 这应该可以工作,但是这些都不会改变文本颜色,而且当我尝试这个时,我的 ActionBar 变得透明。我可以通过改变 AppTheme 中的 textColorPrimary 来改变它的文本颜色,但它也改变了很多东西。
我还想查看任何有关样式在 android 中的工作原理的链接,它的层次结构让我有点困惑
【问题讨论】:
标签: android xml android-actionbar styles