使用片段现在TabActivity是德precated创建标签片段、标签、现在、TabActivity

2023-09-12 01:17:11 作者:爺们狠有范er

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

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

我的标签活动延伸TabActivity我刚才读的德precated,我应该使用片段来代替。

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

如何更改我的应用程序使用的碎片呢?我已阅读android.developer.com的信息,但我仍然不知道如何做到这一点。

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.

推荐答案

您需要使用Android兼容性库使用的片段。它可以被发现在你的Andr​​oid SDK文件夹的JAR文件。

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.

有一个名为项目 ActionBarSherlock 该演示兼容性库的所有功能。来源$ C ​​$ C,也可在github上。这个链接是在那里的网站。

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.

这是另一个教程 http://mobile.tutsplus.com/tutorials/android/android-compatibility-working-with-fragments/