问题
I have a main activity with a sort of dock at the bottom, with 4 icons: A, B, C, D.
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
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 ?
回答1:
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
来源:https://stackoverflow.com/questions/9871038/how-can-i-use-fragments-now-that-tabactivity-is-deprecated