1

Sorry for my english. I try change action bar collor. And i have this error:

error: Error retrieving parent for item: No resource found that matches the given name '@android:style/ Widget.AppCompat.Light.ActionBar.Solid.Inverse'.

I have minSdkVersion = 12

style.xml

    <resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="MyTheme" parent="@android:style/Theme.Holo.Light">
         <item name="android:actionBarStyle">@style/MyActionBar</item>

      </style>

//this is error
      <style name="MyActionBar" parent="@android:style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
         <item name="android:background">#FF9D21</item> 
      </style> 
     </resources>

UPD

I have added appcompat_v7, but its not work

enter image description here

UPD

now style.xml looking that:

<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
             <item name="android:actionBarStyle">@style/MyActionBar</item>

          </style>


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

in manifest:

android:theme="@style/MyTheme" >

i have error:

03-05 12:45:33.860: E/AndroidRuntime(2006): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test6/com.example.test6.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

if i change manifest like that:

android:theme="@style/Theme.AppCompat" >

no error but after this no change color action bar

asdascascaedfa
  • 137
  • 4
  • 11

3 Answers3

8

Try @style/Widget.AppCompat.Light.ActionBar.Solid.Inverse instead .

On a side note, the styles.xml file on appcompat_v7 suggests that @style/Widget.AppCompat.Light.ActionBar.Solid.Inverseis deprecated. @android:style/Widget.DeviceDefault.Light.ActionBar.Solid.Inverse is an alternative.

walljam7
  • 343
  • 2
  • 11
  • 1
    Is your Activity extending ActionBarActivity? Take a look at this post: http://stackoverflow.com/questions/21814825/you-need-to-use-a-theme-appcompat-theme-or-descendant-with-this-activity – walljam7 Mar 05 '15 at 12:58
4

I had this problem in my v21\styles.xml file.

Solution:

parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse"

ban-geoengineering
  • 18,324
  • 27
  • 171
  • 253
0

This works for me

<style name="AppBarStyle" parent="@android:style/Widget.DeviceDefault.Light.ActionBar.Solid.Inverse">
trustidkid
  • 577
  • 4
  • 6