机器人:actionBarStyle需要API级别11 [英] android:actionBarStyle requires API level 11

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

问题描述

当使用 ActionBarSherlock XML格式为:

 <项目名称=机器人:actionBarStyle> @风格/ Widget.Styled.ActionBar< /项目>
 

我得到这个错误:

 安卓actionBarStyle需要API级别11(目前最小为8)错误
 

我用它背我与动作条的应用程序移植到2.2的设备。

如何使用他们两个在一起:

 <项目名称=actionBarStyle> @风格/ Widget.Styled.ActionBar< /项目>
 <项目名称=机器人:actionBarStyle> @风格/ Widget.Styled.ActionBar< /项目>
 

解决方案

您必须只使用:

 <项目名称=actionBarStyle> @风格/ Widget.Styled.ActionBar< /项目>
 

,你可以得到的错误,你有安卓actionBarStyle 提供的API级别11


如果您希望能够风格你动作条看起来相同的所有API级别,你需要创建不同的文件夹选择的API级别,并创造新的 style.xml / 的themes.xml 在这些文件夹中的文件。

例如:

   - 资源
   - 值
      -  styles.xml
      - 的themes.xml // API级别8+
  - 值-V11
      -  styles.xml
      - 的themes.xml // API级别11+
  - 值 -  V14
      -  styles.xml
      - 的themes.xml // API级别14+
 


这是我能想到的第二件事是要小心,它的主题是您,包括您当前在不同的API级别。

例如,对于API级别8:你会使用 @风格/ Theme.Sherlock.Light.DarkActionBar ,你将只需要使用 actionBarStyle 。虽然造型的API级别14+的操作栏,你将不再需要 actionBarStyle ,因为你可能会设置 Holo.Light 主题,父为当前之一,因此在这种情况下,你将不得不使用机器人:actionBarStyle

While using the ActionBarSherlock in xml at:

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

I got this error:

android:actionBarStyle requires API level 11 (current min is 8) error

I'm using it for back porting my app with actionbar to 2.2 devices.

How to use them both together:

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

解决方案

You have to use only :

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

as you can get the error, you have android:actionBarStyle available at API level 11.


If you want to be able to style your ActionBar to look the same in all API levels, you need to create different folders for the selected API level and create new style.xml/themes.xml files in these folders.

For example:

- res
  -- values
     -- styles.xml
     -- themes.xml // API LEVEL 8+
 -- values-v11
     -- styles.xml
     -- themes.xml // API LEVEL 11+
 -- values-v14
     -- styles.xml
     -- themes.xml // API LEVEL 14+


The second thing which I can think of is be careful which themes are you including to your current one at different API Levels.

For example, for API level 8: you will use @style/Theme.Sherlock.Light.DarkActionBar and you will have to use only actionBarStyle. While styling the action bar for API level 14+, you won't need actionBarStyle , because you probably will set Holo.Light theme as parent for your current one, so in this situation you will have to use android:actionBarStyle.

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

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