问题描述
我会通过谷歌提供了与它的SDK此示例包。我试图改变API级至7指出,有项目许多悬而未决的错误。
I was going through this sample package which Google has provided with it's sdk. I tried changing the api level to 7 and observed that there were many unresolved errors in the project.
我列出了几个位置:
- 在ICE_CREAM_SANDWICH不能得到解决或不是场(ActionBarActivity.java)
- 研究不能被解析为一个变量(这可能是由于这样的事实,我的XML也包含错误)
- 在SHOW_AS_ACTION_IF_ROOM不能得到解决或不是场(ActionBarHelperBase.java)
- 的方法setActionView(视图)是未定义的类型菜单项(ActionBarHelperHoneycomb.java)
- 的方法getActionBar()是未定义的类型的活动(ActionBarHelperICS.java)
- 进口android.view.ActionProvider不能被解析(SimpleMenuItem.java)
- 在RES /值-V13 / styles.xml - 错误:错误检索父项:未发现的资源匹配给定名称机器人:款式/TextAppearance.Holo.Widget.ActionBar.Title。
- 错误:错误:未发现的资源匹配给定名称:ATTR机器人:actionBarStyle。 (在RES /值-V11 / styles.xml)
- ICE_CREAM_SANDWICH cannot be resolved or is not a field (ActionBarActivity.java)
- R cannot be resolved to a variable (This is probably due to the fact my xml also contains errors)
- SHOW_AS_ACTION_IF_ROOM cannot be resolved or is not a field (ActionBarHelperBase.java)
- The method setActionView(View) is undefined for the type MenuItem (ActionBarHelperHoneycomb.java)
- The method getActionBar() is undefined for the type Activity (ActionBarHelperICS.java)
- The import android.view.ActionProvider cannot be resolved (SimpleMenuItem.java)
- in res/values-v13/styles.xml - error: Error retrieving parent for item: No resource found that matches the given name 'android:style/TextAppearance.Holo.Widget.ActionBar.Title'.
- error: Error: No resource found that matches the given name: attr 'android:actionBarStyle'. (in res/values-v11/styles.xml)
不知道如何摆脱这些错误的?基本上,我针对Android设备2.x及更高版本。是否使用actionbarsherlock是另一种选择?我在这里读了一些关于后2.x的Android设备的操作栏兼容包工程为好。
Any idea how to get rid of these errors? Basically I'm targeting android devices 2.x and later. Does using actionbarsherlock is another alternative? I read here on some post that action bar compatibility package works on 2.x android devices as well.
推荐答案
您不应该改变的API版本。该清单声明最小的SDK版本为4,这意味着它将工作在2.x的设备。尝试在模拟器上加载它,使用API版本14编译。
You shouldn't change the api version. The manifest declares min-sdk-version as 4, which means it will work on 2.x devices. Try loading it on the emulator, using api version 14 to compile.
这篇关于Android的动作条的兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!