gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 14:21:37 25 4
gpt4 key购买 nike

对不起我的英语。我尝试更改操作栏颜色。我有这个错误:

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

我有 minSdkVersion = 12

样式.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>

在 list 中:

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.

如果我像这样更改 list :

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 是一个替代方案。

关于android - 找不到与给定名称 '@android:style/Widget.AppCompat.Light.ActionBar.Solid.Inverse' 匹配的资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28877156/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com