How to change action bar background and text colors

前端 未结 1 1494
臣服心动
臣服心动 2021-01-29 08:53

I am using navigation drawer from this tutorial

http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/

and i am trying to change acti

相关标签:
1条回答
  • 2021-01-29 09:24

    Try this in styles.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">
            <item name="android:actionBarStyle">@style/MyActionBar</item>
        </style>
    
        <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
            <item name="android:background">@color/titlebackgroundcolor</item>
            <item name="android:titleTextStyle">@style/MyActionBar.Text</item>
        </style>
    
        <style name="MyActionBar.Text" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
            <item name="android:textColor">#FFFF00</item>
        </style>
    
    </resources>
    

    Remove these two lines:

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mytitle);
    

    It will work for you.

    0 讨论(0)
提交回复
热议问题