0

I want to change the color of my ActionBar but the color I want to apply doesn't show. Here's my Style.xml file.

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="android:actionBarStyle">@style/ActionBarTheme</item>
    <!-- Customize your theme here. -->
</style>

<style name="ActionBarTheme" parent="Theme.AppCompat.Light">
    <item name="android:background">#2196f3</item>
</style>

<style name="AboutActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>

Chiranjeev Jain
  • 89
  • 3
  • 10
  • Check this post (http://stackoverflow.com/questions/27744872/actionbar-in-api-8-10-in-android/27745149#27745149) – Xcihnegn Mar 06 '15 at 14:08

3 Answers3

0

I think in your activity your extending Activity not ActionBarActivity

please extend ActionBarActivity in your java file like

public class MainActivity extends ActionBarActivity{.......}
Nooh
  • 1,548
  • 13
  • 21
0
<resources>
    <style name="MyTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
    </style>

    <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:background">ANY_HEX_COLOR_CODE</item>
    </style>
</resources>

You also have to set MyTheme to the activity in the AndroidManifest properly.

Like in this thread : How do I change the background color of the ActionBar of an ActionBarActivity using XML?

Community
  • 1
  • 1
A B
  • 338
  • 3
  • 10
0

Found that AppCompat used colorPrimary to change ActionBar color. Used the following colde and it worked. Hit the Up button if this answer helps you.

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="colorPrimary">#2196f3</item>
    <!-- Customize your theme here. -->
</style>

<style name="AboutActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>

Chiranjeev Jain
  • 89
  • 3
  • 10