[英]change action bar title color Theme.AppCompat.Light.DarkActionBar android
I wants to change the action bar title color to white in android . 我想在android中将操作栏标题颜色更改为白色。 and i am using theme in values Theme.AppCompat.Light
and values-14 Theme.AppCompat.Light.DarkActionBar
我在值Theme.AppCompat.Light
和values-14使用主题Theme.AppCompat.Light.DarkActionBar
I have tried so far in values folder : 到目前为止我在values文件夹中尝试过:
<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 和值-14文件夹
<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. 但ActionBar标题颜色没有变化。
You can specify the background color of the ActionBar
by using the colorPrimary
attribute; 您可以使用colorPrimary
属性指定ActionBar
的背景颜色; 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
; 以上是为AppCompat
创建的特殊标记; you will notice that the android:
namespace is omitted. 你会注意到android:
namespace被省略了。
If you are using Theme.AppCompat.Light.NoActionBar do 如果您使用的是Theme.AppCompat.Light.NoActionBar
<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
属性,它将优先于主题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.