Android的AppCompat需要API级别11 [英] Android AppCompat requires API level 11

查看:168
本文介绍了Android的AppCompat需要API级别11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用AppCompat支持libary的其他动作的应用程序。现在我试图创建一些风格为目的的新的themes.xml文件。

I have an app that uses the AppCompat support libary for ActionBars. Now I tried to create a new themes.xml file with some style for that purpose.

<!-- Application theme. -->
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="actionBarStyle">@style/MyActionBar</item>
</style>

所以才以同样的方式也都是在这里完成:<一href="http://developer.android.com/guide/topics/ui/actionbar.html#StyleExample">http://developer.android.com/guide/topics/ui/actionbar.html#StyleExample 然而,这里的Eclipse抛出一个错误,说:

So just the same way it is done here: http://developer.android.com/guide/topics/ui/actionbar.html#StyleExample However, Eclipse throws an error here and says:

android:actionBarStyle requires API level 11 (current min is 8) themes.xml

这是怎么回事,因为我现在用的是支持libary?

How can this be as I am using the support libary?

推荐答案

添加下面的 styles.xml RES /值-14

<style name="Theme.Styled" parent="@style/Theme.AppCompat.Light">
    <!-- Setting values in the android namespace affects API levels 14+ -->
    <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>

</style>

<style name="Widget.Styled.ActionBar" parent="@style/Widget.AppCompat.Light.ActionBar">
    <!-- Setting values in the android namespace affects API levels 14+ -->
    <item name="android:background">#FFFFFF</item>

</style>

然后需要添加以下到值的文件夹: RES /价值/ styles.xml

<style name="Theme.Styled" parent="@style/Theme.AppCompat.Light">
    <!-- Setting values in the default namespace affects API levels 7-13 -->
    <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
</style>

<style name="Widget.Styled.ActionBar" parent="@style/Widget.AppCompat.Light.ActionBar">
    <!-- Setting values in the default namespace affects API levels 7-13 -->
    <item name="background">#FFFFFF</item>
</style>

详情

<一个href="http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html">http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html

注意的API级别的变化14 +

Notice the change for API level 14+

 <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>

要API级别7-13

To API level 7-13

 <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>

这篇关于Android的AppCompat需要API级别11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆