简体   繁体   English

Android:使用ActionBarSherlock库

[英]Android : The use of the ActionBarSherlock library

I want to create an application that will target old Android platforms (>= 2.x). 我想创建一个针对旧Android平台(> = 2.x)的应用程序。

I found the ActionBarSherlock that allows building action bars in an ICS style. 我找到了ActionBarSherlock ,它允许以ICS风格构建动作条。

But, when I read its FAQ , I found that I have to compile my project with the API level 14 (4.0 : ICS) and target the API level 11 in my manifest (3.0 : Honeycomb). 但是,当我阅读它的FAQ时 ,我发现我必须使用API​​级别14(4.0:ICS)编译我的项目,并在我的清单(3.0:Honeycomb)中定位API级别11。

So, my question is : how can I target the 2.x versions with ActionBarSherlock? 所以,我的问题是:如何使用ActionBarSherlock定位2.x版本?

This is a very common question and the answer is relatively simple. 这是一个非常常见的问题,答案相对简单。 Just because you target 4.0 does not mean it will not run on earlier versions. 仅仅因为你的目标4.0并不意味着它不会在早期版本上运行。 In your manifest you need to add the following: 在清单中,您需要添加以下内容:

<uses-sdk
    android:minSdkVersion="7"
    android:targetSdkVersion="14" />

As you can see this effectively says you are targeting API level 14 however the minimum API level supported is 2.1 (update 1). 正如您所看到的,这有效地表示您的目标是API级别14,但支持的最低API级别为2.1(更新1)。

This is all clearly explained in the documentation on the ABS site. ABS网站上的文档都清楚地解释了这一点。 If you wish to know more about the <uses-sdk> tag then visit http://developer.android.com/guide/topics/manifest/uses-sdk-element.html 如果您想了解有关<uses-sdk>标签的更多信息,请访问http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM