问题描述
我有在底部排序码头的主要活动,具有4个图标:A,B,C,D
I have a main activity with a sort of dock at the bottom, with 4 icons: A, B, C, D.
我已经尝试过让这里的问题涉及替换一个给选项卡中的片段,但没有得到答案。我开始想,也许我是标题下一个错误的道路。所以,现在我想起来实现它的一种新的方式,基本上迫使我使用pcated TabActivity现在去$ P $。现在的问题是,为什么它去precated?
I already tried getting a response to a question here involving replacing a fragment within a given tab but did not get an answer. I began to think that maybe I was heading down a wrong path. So now I thought up a new way of implementing it which basically forces me to use the now deprecated TabActivity. The question is, why is it deprecated?
我的想法是实现一个系统这样的:
My idea is to implement a system as such :
TabActicity(TabActivity)
Tab A(FragmentActivity) -> Fragments
Tab B(FragmentActivity) -> Fragments
Tab C(FragmentActivity) -> Fragments
Tab D(FragmentActivity) -> Fragments
这意味着每个标签都有自己fragmentActivity,其片段。这是实施该系统,而不是有一个FragmentActivity作为我TabController和使用片段作为每个标签的方法是什么?
Meaning each Tab has its own fragmentActivity that its fragments. Is this the way of implementing the system instead of having a FragmentActivity as my TabController and using fragments as each individual tab ?
推荐答案
在Android的文档,你找到如何使用一个片段的TabHost例子。没有TabActivity需要。
这里是例子:http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html
In the Android docs you find an example of how to use a TabHost with Fragments. No TabActivity needed.Here is the example: http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html
这篇关于如何使用碎片,现在TabActivity是德precated?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!