【问题标题】:Change ActionBarCompat title color but not other texts color更改 ActionBarCompat 标题颜色但不更改其他文本颜色
【发布时间】:2014-12-24 09:12:07
【问题描述】:

我正在使用最新版本的支持库 (V21),其中包括材料主题(在 Theme.AppCompat 名称下),我想将 ActionBar 标题设为白色。我试图通过在我的自定义主题中使用 textColorPrimary(如 there 所示)属性来实现它

<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
    <item name="colorPrimary">@color/orange</item>
    <item name="colorPrimaryDark">@color/orange_dark</item>
    <item name="colorAccent">@color/white</item>

    <!-- This attribut set text color --> 
    <item name="android:textColorPrimary">@color/white</item>
</style>

有了这个我得到了一个白色的动作栏标题但所有其他文本(textview,edittext)也是白色的......

有没有办法使用最近发布的功能仅更改操作栏标题颜色,或者唯一的方法是为操作栏使用自定义样式,就像 Holo 的情况一样?

【问题讨论】:

    标签: android android-5.0-lollipop android-actionbar-compat


    【解决方案1】:

    使用@style/Theme.AppCompat.Light.DarkActionBar 仅在操作栏中反转文本颜色。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-24
      • 1970-01-01
      • 1970-01-01
      • 2017-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-05
      相关资源
      最近更新 更多