我正在尝试在 Android 上创建一个应用程序,并希望将应用程序一直定位到 Android 2.2。
我对如何配置应用程序有点困惑
最低 SDK:2.2 目标 SDK:4.1 编译 SDK 针对:4.2
这是我创建新 Android 项目时获得的默认配置。
我还需要使用 ActionBar Sherlock 来支持旧版本吗?
最佳答案
除非您使用任何不适用于较低版本的 API,否则您将不需要任何额外的库,例如 ActionBarSherlock。
但是,如果您正在使用任何特定的 API 并希望它们向后兼容,例如 Fragments
、ActionBar
等,那么您可以使用 Support Library,它支持最低 API 级别 4。
引自支持库页面:
Minimum API level supported: 4
The Support Package includes static "support libraries" that you can add to your Android application in order to use APIs that are either not available for older platform versions or that offer "utility" APIs that aren't a part of the framework APIs. The goal is to simplify your development by offering more APIs that you can bundle with your application so you can worry less about platform versions.
ABS 是支持库的扩展。这是来自 ABS 页面链接:ActionBarSherlock:
The library will automatically use the native action bar when appropriate or will automatically wrap a custom implementation around your layouts. This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
总而言之,如果您要使用旧版 SDK 中不可用的 API,则可以使用上面列出的两者之一。如果您不使用特定于较新 SDK 的 API,则不需要 ABS 或支持库。
关于Android Action 兼容性从 2.2 到 4.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13524604/