0

I've tried to change the color of the action bar in 100 ways, but it's still the same. Here is my code:

<resources>

<!-- Base application theme. -->

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="android:statusBarColor">#00B0FF</item>
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">#ffffff</item>
</style>

Can someone explain me where is my mistake?

user3330053
  • 173
  • 1
  • 16

3 Answers3

1

Try this:

<resources>

<!-- Base application theme. -->

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <!-- Customize your theme here. -->
    <item name="android:statusBarColor">#00B0FF</item>
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">#ffffff</item>
</style>
mmlooloo
  • 18,937
  • 5
  • 45
  • 64
0

If you are extends material design api 21 => take a look

<resources>
    <!-- inherit from the material theme -->
    <style name="AppTheme" parent="android:Theme.Material">
      <!-- Main theme colors -->
      <!--   your app branding color for the app bar -->
      <item name="android:colorPrimary">@color/primary</item>
      <!--   darker variant for the status bar and contextual app bars -->
      <item name="android:colorPrimaryDark">@color/primary_dark</item>
      <!--   theme UI controls like checkboxes and text fields -->
      <item name="android:colorAccent">@color/accent</item>
    </style>
</resources>

But if you are extends AppCompat => take a look

<resources>
    <!-- inherit from App Compat theme -->
    <style name="AppTheme" parent="Theme.AppCompat.Light"">
      <!-- Main theme colors -->
      <!--   your app branding color for the app bar -->
      <item name="colorPrimary">@color/primary</item>
      <!--   darker variant for the status bar and contextual app bars -->
      <item name="colorPrimaryDark">@color/primary_dark</item>
      <!--   theme UI controls like checkboxes and text fields -->
      <item name="colorAccent">@color/accent</item>
    </style>
</resources>

We now use the support implementation of Toolbar/ActionBar on all platforms meaning that we no longer read any android: attributes related to the action bar. Chris Banes

Neige
  • 2,770
  • 2
  • 15
  • 21
0

please try this code in value-v14 and also select theme as myAppTheme In Munifest.xml

 <style name="ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">

    <item name="android:background">@color/color1</item>
    <item name="android:backgroundStacked">@color/color1</item>
    <item name="android:backgroundSplit">@color/color1</item>
    <item name="android:statusBarColor">@color/staus_bar_color</item>
 </style>
 <style name="myAppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/ActionBar</item>
  </style>
Dhms005
  • 1
  • 1