使用AppCompat库动作条支持 [英] Use AppCompat Library for ActionBar support
问题描述
我需要实现在安卓2.x的我已经试过的这个岗位和设置中所提到的这个的官方文章。
I need to implement the actionbar in Android 2.x I've tried with this post and setup the support library as mentioned in thisofficial article.
下面是我遵循的使用appcompat支持库实现动作条的步骤:
Here are the steps that I've followed for implement the ActionBar using the appcompat support library:
首先,创建具有以下配置的项目(我不创建一个图标和默认的活动):
First, I create the project with the following configuration (I don't create an icon and a default activity):
最低要求SDK: API 10:Android的2.3.3(姜饼)
目标SDK: API 19:Android 4.4系统
与编译: API 10:Android的2.3.3(姜饼)
主题:无。
Minimum Required SDK: API 10: Android 2.3.3 (Gingerbread)
Target SDK: API 19: Android 4.4
Compile with: API 10: Android 2.3.3 (Gingerbread)
Theme: None
后,在项目属性 => 机器人 => 库我添加了 Android的支持-V7-appcompat 库项目。
After, in the Project properties => Android => Library I add the android-support-v7-appcompat library project.
在此,我得到的 128错误这样在我使用 appcompat 库中的项目。所有这些都与河洛主题相关的:
After this, I get 128 errors like this in the project where I use the appcompat library. All of them are related with the Holo theme:
[2013-12-06 13:24:24 - UsingSupportActionBar] C:\dev\Java\android\adt-bundle-windows-x86_64\sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar'.
请注意,该错误只发生在值-V14 和值-V11 文件夹在 appcompat 库项目。下面是我得到了错误的2个例子:
Please, note that the error only occurs with the values-v14 and values-v11 folders in the appcompat library project. Here are 2 examples of the errors I get:
[2013-12-06 13:24:24 - UsingSupportActionBar] C:\dev\Java\android\adt-bundle-windows-x86_64\sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:100: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Subtitle.Inverse'.
[2013-12-06 13:24:24 - UsingSupportActionBar] C:\dev\Java\android\adt-bundle-windows-x86_64\sdk\extras\android\support\v7\appcompat\res\values-v11\styles_base.xml:26: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ProgressBar.Horizontal'.
另外,还有一些不符合河洛主题相关的一些错误:
Also, there are few error not related with the Holo theme:
[2013-12-06 13:24:38 - UsingSupportActionBar] C:\dev\Java\android\adt-bundle-windows-x86_64\sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:225: error: Error: No resource found that matches the given name: attr 'android:dividerPadding'.
[2013-12-06 13:24:38 - UsingSupportActionBar] C:\dev\Java\android\adt-bundle-windows-x86_64\sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:224: error: Error: No resource found that matches the given name: attr 'android:showDividers'.
[2013-12-06 13:24:38 - UsingSupportActionBar] C:\dev\Java\android\adt-bundle-windows-x86_64\sdk\extras\android\support\v7\appcompat\res\values-v11\themes_base.xml:33: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
[2013-12-06 13:24:38 - UsingSupportActionBar] C:\dev\Java\android\adt-bundle-windows-x86_64\sdk\extras\android\support\v7\appcompat\res\values-v11\themes_base.xml:44: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
[2013-12-06 13:24:38 - UsingSupportActionBar] C:\dev\Java\android\adt-bundle-windows-x86_64\sdk\extras\android\support\v7\appcompat\res\values-v14\themes_base.xml:41: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
[2013-12-06 13:24:38 - UsingSupportActionBar] C:\dev\Java\android\adt-bundle-windows-x86_64\sdk\extras\android\support\v7\appcompat\res\values-v14\themes_base.xml:67: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
[2013-12-06 13:24:38 - UsingSupportActionBar] C:\dev\Java\android\adt-bundle-windows-x86_64\sdk\extras\android\support\v7\appcompat\res\values-v14\themes_base.xml:94: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
有没有人有同样的问题?
Has anyone had the same problem?
推荐答案
设置编译与以API等级19,以及 - 当你用SDK 10级的编译程序,编译器不知道的元素显示在错误日志。
Set "Compile with" to API Level 19 as well - when you compile your app with SDK level 10, the compiler doesn't know the elements shown in the error log.
这篇关于使用AppCompat库动作条支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!