android – 将主题应用于v7支持操作栏

前端之家收集整理的这篇文章主要介绍了android – 将主题应用于v7支持操作栏前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用支持v7库在我的应用程序中实现ActionBar ..我在styles.xml文件中有这个 @H_404_2@<?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:actionBarStyle">@style/ActionBarTheme</item> </style> <style name="ActionBarTheme" parent="android:Widget.ActionBar"> <item name="android:background">#FFFF0000</item> </style> </resources>

但是,Eclipse在actionBarStyle行中抱怨.错误是这一个:

android:actionBarStyle需要API级别11(当前最小值为8)

如何将我的主题应用于API级别8-10?

解决方法

您需要提供两个API特定的styles.xml.在您的values / styles.xml中使用 @H_404_2@<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="actionBarStyle">@style/ActionBarTheme</item> </style>

并在你的values-v14 / styles.xml中使用

@H_404_2@<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:actionBarStyle">@style/ActionBarTheme</item> </style>

猜你在找的Android相关文章