如何更改片段中的操作栏标题颜色



我在片段中有一个导航抽屉。我想更改此片段中的操作栏标题颜色。对于所有其他屏幕,我使用了自定义操作栏,并且在那里工作正常。我还指定了操作栏标题的样式。这是我的风格.xml

<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
    Base application theme, dependent on API level. This theme is replaced
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="CustomActionBarTheme"  parent="@android:style/Theme.Holo">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
       parent="@android:style/Widget.Holo.ActionBar">
    <item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
</style>
 <!-- ActionBar title text -->
<style name="MyActionBarTitleText"   parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColorPrimary">@color/ActionBar_text</item>
</style>
 <style name="PoppupMenu" parent="android:Widget.PopupMenu">
    <item name="android:popupBackground">@android:color/white</item>
 </style>

您想要将

自定义操作栏主题的父级更改为@style/应用程序主题

<style name="CustomActionBarTheme"  parent="@stye/AppTheme">

然后将 android:textColorPrimary 更改为 android:textColor

<item name="android:textColor">@color/ActionBar_text</item>

相关内容

  • 没有找到相关文章

最新更新