ItGo.me Focus on IT Recommend

Home > java - Changing app's background, action bar's background and title text color supporting api level >= 14

java - Changing app's background, action bar's background and title text color supporting api level >= 14

I have been searching how to change the app's background color along with different action bar colors and action bar title text colors without any luck. This is what I am currently doing but it's not working:

<resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="AppTheme" parent="@style/Theme.AppCompat.Light">
        <!-- Setting values in the android namespace affects API levels 14+ -->
        <item name="android:actionBarStyle">@style/MyStyledActionBar</item>
    </style>

    <style name="MyStyledActionBar" parent="@style/Widget.AppCompat.Light.ActionBar">
        <!-- Setting values in the android namespace affects API levels 14+ -->
        <item name="android:background">@color/actionbar_background_color</item>
        <item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
        <item name="android:actionMenuTextAppearance">@style/MyActionBarMenuText</item>
        <item name="android:actionMenuTextColor">@color/actionbar_text_color</item>
    </style>

    <style name="MyActionBarTitleText" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
        <item name="android:textColor">@color/actionbar_text_color</item>
    </style>

    <style name="MyActionBarMenuText" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Menu">
        <item name="android:textColor">@color/actionbar_text_color</item>
    </style>

</resources>

This renders the following:

However, according to my color.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="actionbar_background_color">#2d3135</color>
    <color name="actionbar_text_color">#ffffff</color>
    <color name="app_background_color">#f7f6f0</color>
    <color name="button_background_color">#2d3135</color>
    <color name="button_text_color">#ffffff</color>
</resources>

The output should be something like this: (just see the background color of actionbar and it's text color)

Also, how do I change the background color of the whole app.

P.S: Even if the color of the actionbar in the wanted-output is default of android, i still want it to be changed.

java android android-studio colors appcompat
asked Apr 20 '16 at 21:30 Mohammad Areeb Siddiqui 5,562 7 39 72

 | 

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

oriUlr:http://stackoverflow.com/questions/36755576/changing-apps-background-action-bars-background-and-title-text-color-supporti

------splitte line----------------------------