既然 TabActivity 已弃用,则使用 Fragments 创建选项卡

发布于 2024-12-07 03:07:59 字数 177 浏览 4 评论 0原文

我正在创建一个应用程序,该应用程序在屏幕底部有五个选项卡,每个选项卡都会打开一个不同的活动。

我的选项卡活动扩展了我刚刚读到的选项卡活动已被弃用,我应该使用片段代替。

如何更改我的应用程序以使用 Fragment?我已阅读 android.developer.com 上的信息,但我仍然不知道如何执行此操作。

I am creating an application which has five tabs at the bottom of the screen, each of which opens a different Activity.

My Tab Activity extends TabActivity which I have just read is deprecated and I should use Fragments instead.

How do I change my app to use Fragments instead? I have read the information on android.developer.com but I still have no idea how to do this.

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

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

发布评论

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

评论(1

叫嚣ゝ 2024-12-14 03:07:59

您需要使用 android 兼容性库才能使用片段。它可以作为 jar 文件在您的 android sdk 文件夹中找到。

有很多关于片段的教程。

有一个名为 ActionBarSherlock 的项目,它演示了兼容性库的所有功能。源代码也可以在 github 上找到。该链接位于该网站上。

这是另一个教程
http://mobile.tutsplus.com/tutorials/android/android-compatibility-working -带片段/

You will need to use the android compatibility library to use fragments. It can be found as a jar file in your android sdk folder.

There are many tutorials out there for fragments.

There is a project named ActionBarSherlock which demos all the capability of the compatibility library. Source code is also available on github. The link is on there site.

This is another tutorial
http://mobile.tutsplus.com/tutorials/android/android-compatibility-working-with-fragments/

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