I wants to change the action bar title color to white in android . and i am using theme in values Theme.AppCompat.Light
and values-14 Theme.AppCompat.Light.DarkActionBar
I have tried so far in values folder :
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:textColor">@android:color/white</item>
</style>
and values -14 folder
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:textColor">@android:color/white</item>
</style>
but ActionBar title color is not changing.
You can specify the background color of the ActionBar
by using the colorPrimary
attribute; something like the following:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@android:color/white</item>
</style>
The above is a special tag created for AppCompat
; you will notice that the android:
namespace is omitted.
If you are using Theme.AppCompat.Light.NoActionBar do
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="@color/background_material_dark"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
你还应该检查你在布局xml文件中没有指定一个android:theme
属性,它将优先于主题
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.