- 我在 Android 上有一个 9 级应用程序,我想知道是否可以在同一项目中使用 11 级 (Android 3.0) 的新功能?
- 对于 3.0 平板电脑版本,我的布局将包含 fragment 。如何使用这些 fragment 并让 9 级版本成功构建并运行?
- 我可以为不同的 API 级别(在 res/layout 中)定义不同的布局吗?
- 如果我保留 2 个版本,一个用于平板电脑,另一个用于手机,我可以将其添加到具有相同软件包名称的 android-marketplace 吗?
最佳答案
I have a level 9 app on android, and I want to know if I can use new features from level 11 (Android 3.0) in the same project?
是的,按照 Willis 先生的建议,通过反射或条件类加载。 Here is a sample application演示了操作栏的这一点,这也是 API 级别 11 的新功能。
For 3.0 tablet version, my layouts will contain fragments. How do I use these fragments and allow the level 9 version to build and run successfully?
使用Android compatibility library .
Can I define different layouts for different API levels (in the res/layout)?
是的,通过-vNN
资源集后缀(例如res/layout-v11
)。但是,您应该尽量减少这种情况。
If I keep 2 versions, one for tablet other for phones, can I add that to the android-marketplace with the same package name?
没有。
关于android - 在同一项目中支持3.0及以下级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5353233/