简体   繁体   English

更改操作栏标题颜色Theme.AppCompat.Light.DarkActionBar android

[英]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.

相关问题 将android:Theme.Light更改为Theme.AppCompat.Light.DarkActionBar - change android:Theme.Light to Theme.AppCompat.Light.DarkActionBar Theme.AppCompat.Light.DarkActionBar未显示操作栏 - Theme.AppCompat.Light.DarkActionBar is not showing Action bar 操作栏未显示:首选项活动中的Theme.Appcompat.Light.DarkActionBar - Action bar not showing :Theme.Appcompat.Light.DarkActionBar in preference activity 如何更改textview的默认颜色(Theme.AppCompat.Light.DarkActionBar) - How to change textview default color (Theme.AppCompat.Light.DarkActionBar) Theme.AppCompat.Light.DarkActionBar提供黑色操作栏标题文本 - Theme.AppCompat.Light.DarkActionBar giving black actionbar title text 如何在Theme.AppCompat.Light.DarkActionBar主题中更改菜单项的文本颜色? - How to change the text color of a menu item in Theme.AppCompat.Light.DarkActionBar theme? Theme.AppCompat.Light.DarkActionBar的默认文本颜色是什么? - What is the default text color for Theme.AppCompat.Light.DarkActionBar? android:popupMenuStyle不能与Theme.AppCompat.Light.DarkActionBar一起使用 - android:popupMenuStyle doesn't work with Theme.AppCompat.Light.DarkActionBar 找不到资源 - Theme.AppCompat.Light.DarkActionBar - No resource found - Theme.AppCompat.Light.DarkActionBar Theme.AppCompat.Light.DarkActionBar - 找不到资源 - Theme.AppCompat.Light.DarkActionBar - No resource found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM