asd*_*dfa 1 xml android 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>
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
在清单中:
android:theme="@style/MyTheme" >
Run Code Online (Sandbox Code Playgroud)
我有错误:
03-05 12:45:33.860:E/AndroidRuntime(2006):java.lang.RuntimeException:无法启动活动ComponentInfo {com.example.test6/com.example.test6.MainActivity}:java.lang.IllegalStateException:You需要在此活动中使用Theme.AppCompat主题(或后代).
如果我改变那样的清单:
android:theme="@style/Theme.AppCompat" >
Run Code Online (Sandbox Code Playgroud)
没有错误,但在此之后没有更改颜色操作栏
小智 8
试试吧@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse.
另外,appcompat_v7上的styles.xml文件表明@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse不推荐使用该文件. @android:style/Widget.DeviceDefault.Light.ActionBar.Solid.Inverse是另一种选择.
| 归档时间: |
|
| 查看次数: |
7059 次 |
| 最近记录: |