找不到与给定名称匹配的资源'@android:style / Widget.AppCompat.Light.ActionBar.Solid.Inverse'

时间:2015-03-05 11:46:30

标签: android xml styles android-manifest

抱歉我的英文。我尝试改变动作栏collor。我有这个错误:

  

错误:检索项目的父项时出错:找不到资源   匹配给定名称'@android:style /   Widget.AppCompat.Light.ActionBar.Solid.Inverse”。

我有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

我添加了appcompat_v7,但它不起作用

enter image description here

UPD

现在找到了style.xml:

<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> 
清单中的

android:theme="@style/MyTheme" >

我有错误:

  

03-05 12:45:33.860:E / AndroidRuntime(2006):   java.lang.RuntimeException:无法启动活动   ComponentInfo {com.example.test6 / com.example.test6.MainActivity}:   java.lang.IllegalStateException:您需要使用Theme.AppCompat   这个活动的主题(或后代)。

如果我改变那样的清单:

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

没有错误,但在此之后没有更改颜色操作栏

3 个答案:

答案 0 :(得分:6)

请尝试@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse

在旁注中,the styles.xml file on appcompat_v7表示不推荐使用@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse@android:style/Widget.DeviceDefault.Light.ActionBar.Solid.Inverse是另一种选择。

答案 1 :(得分:2)

我的 v21 \ styles.xml 文件中存在此问题。

解决方案:

'Authorization' : 'Basic dXNlcm5hbWU6cGFzc3dvcmQK'

答案 2 :(得分:0)

这对我有用

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