我正在使用appcompat v7库来支持api级别为8及以上的操作栏。 我试图更改操作栏标题文本的颜色。
在GingerBread中,标题文本的颜色会改变,但是当我在JellyBean上运行应用程序时,颜色不会改变。
在GingerBread上,标题颜色变为红色: (插图)
在JellyBean上它仍然是黑色: (插图)
这是我的styles.xml文件:
在GingerBread中,标题文本的颜色会改变,但是当我在JellyBean上运行应用程序时,颜色不会改变。
在GingerBread上,标题颜色变为红色: (插图)
在JellyBean上它仍然是黑色: (插图)
这是我的styles.xml文件:
<resources>
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
<item name="actionBarStyle">@style/ActionBarStyle</item>
</style>
<style name="ActionBarStyle" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
<item name="titleTextStyle">@style/TitleBarTextColor</item>
</style>
<style name="TitleBarTextColor" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/red</item>
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
v-11版本的styles.xml:
<resources>
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
<item name="actionBarStyle">@style/ActionBarStyle</item>
</style>
</resources>
v-14 版本的 styles.xml:
<resources>
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
<item name="actionBarStyle">@style/ActionBarStyle</item>
</style>
</resources>
清单:
android:theme="@style/AppTheme"