使用AppCompat Library进行ActionBar支持

 高--洁 发布于 2023-02-12 13:10

我需要在Android 2.x中实现操作栏我已经尝试过这篇文章并设置了这篇官方文章中提到的支持库.

以下是我使用appcompat支持库实现ActionBar所遵循的步骤:

首先,我使用以下配置创建项目(我不创建图标和默认活动):

最低要求SDK: API 10:Android 2.3.3(Gingerbread)
目标SDK: API 19:Android 4.4
编译: API 10:Android 2.3.3(Gingerbread)
主题:无

之后,在Project properties => Android => Library中添加了android-support-v7-appcompat库项目.

在此之后,我在使用appcompat库的项目中得到了128个这样的错误.所有这些都与Holo主题有关:

[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'.  

请注意,错误仅发生在appcompat库项目中的values-v14values-v11文件夹中.以下是我得到的两个错误示例:

[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'.  

此外,与Holo主题无关的错误很少:

[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'.  

有没有人有同样的问题?

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有