找不到与给定名称“@android:style/Widget.AppCompat.Light.ActionBar.Solid.Inverse”匹配的资源
No resource found that matches the given name '@android:style/Widget.AppCompat.Light.ActionBar.Solid.Inverse'
对不起我的英语。我尝试更改操作栏颜色。我有这个错误:
error: Error retrieving parent for item: No resource found that
matches the given name '@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,但是它不起作用
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: 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.
如果我这样更改清单:
android:theme="@style/Theme.AppCompat" >
没有错误,但在此之后没有改变颜色操作栏
请尝试 @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
是备选方案。
我的 v21\styles.xml 文件中有这个问题。
解决方案:
parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse"
这对我有用
<style name="AppBarStyle" parent="@android:style/Widget.DeviceDefault.Light.ActionBar.Solid.Inverse">
对不起我的英语。我尝试更改操作栏颜色。我有这个错误:
error: Error retrieving parent for item: No resource found that matches the given name '@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,但是它不起作用
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: 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.
如果我这样更改清单:
android:theme="@style/Theme.AppCompat" >
没有错误,但在此之后没有改变颜色操作栏
请尝试 @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
是备选方案。
我的 v21\styles.xml 文件中有这个问题。
解决方案:
parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse"
这对我有用
<style name="AppBarStyle" parent="@android:style/Widget.DeviceDefault.Light.ActionBar.Solid.Inverse">