创建一个在 v11 中具有额外功能但仍在 v7 中运行的应用程序

发布于 2024-11-30 00:56:10 字数 519 浏览 4 评论 0原文

我遇到了这个问题,并且一直在努力解决这个问题,但在 v11/3.0+ 上运行时无法看到如何在应用程序中使用 ActionBar,然后在 v7/2.1 中使用内部 ActionBar

问题的问题是,当您使用任何标签(例如 android:actionBarStyle)或 v11 库中的库时,您的应用将不再使用低于 v11 的库进行编译。因此您将无法在手机上运行它。

但是

我一直在查看 Google IO 2011 应用程序的源代码,它使用 v7 作为默认库。然而,它被设计为使用 ActionBar,因为它具有上述标签 (android:actionBarStyle)。但由于我的手机上有一个内置版本,并且它有大量用于在低于 v11 的设备上创建假 ActionBar 的代码,因此显然应该能够在两者上构建。

显然我遗漏了一块拼图。如何获得 Google IO 2011 应用程序构建?有什么机制可以让您同时开发多个版本?

请有人帮忙。

I've had a problem with this and have been running my head up against it and couldn't see how to use an ActionBar in the app when running on v11/3.0+ and then use an in house ActionBar in v7/2.1

The problem is that when you use any of the tags (such as android:actionBarStyle) or libraries from v11 library, your app will no longer compile with a library lower than v11. Therefore you won't be able to run it on a phone.

However

I've been looking at the source to the Google IO 2011 application and it uses v7 as a default library. It is designed however to use the ActionBar as it has the above tag in it (android:actionBarStyle). But since I have a built version on my phone and it has alot of code for creating a fake ActionBar when on devices lower than v11 it obviously should be able to be built on both.

Obviously there is a peice of the puzzle I'm missing. How do I get the Google IO 2011 app building? What mechanism is in place which allows you to develop for multiple versions at once?

Someone please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷情妓 2024-12-07 00:56:10

这个愚蠢的问题来自于我正在处理的 3 个不同问题让我自己感到困惑。

只要 AndroidManifest.xml 文件中的 android:minSdkVersion 属性已设置为或低于手机版本,使用 v11 库构建的应用程序就可以在手机上正常运行。但是,依赖于后续库的功能将无法使用。

我认为 Google IO 2011 应用程序附带默认 v7 库的原因是我从 eclipse 中的源代码创建了一个项目 - 我没有导入项目。

(我会在这里写它,因为我可以 - 如果您打算使用 v11 之前的 Fragments,则不能使用为方便起见而写入 v11 代码的 Fragment 代码,因为 android.app.Fragment 不是与 android.support.v4.app.Fragment 兼容,只需忽略它并从 getSupportManager() 等中检索钩子即可。

所以,我撤回我的问题:)

Stupid Question which comes from confusing myself over 3 different issues I'm juggling.

Apps built with v11 library will happily run on a phone as long as the android:minSdkVersion attribute in the AndroidManifest.xml file has been set to or below the version of the phone. However, the functionality which relies on the later libraries won't work.

The reason I thought the Google IO 2011 app came with a default v7 library is that I created a project from the source in eclipse - I didn't import a project.

(And I'll write it here since I can - The Fragment code written into v11 code for convenience can't be used if you intent to use Fragments pre v11 as android.app.Fragment isn't compatible with android.support.v4.app.Fragment. It just needs to be ignored and hooks retrieved from getSupportManager() etc.).

So, I withdraw my question :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文