I'm updating my app to use fragments instead of activites to later make a better ui for tablet. and as i have minSdk=14 i thought i could throw away support.v4 but now i want a fragment with some tabbed sub fragments. only way i found without the support library is the ActionBar tab stuff. but for tablets i want to have something like this
Left: single fragment (not changing)
Right: changing fragments where some can contain tabs
i want the tabs only visible on the right side and not on actionbar level above both sides. is there a way(thats worth the effort) to do this without support.v4 or should i redo the code i have to use the support.v4 fragment classes that i can use FragmentTabHost provided by support.v4 lib?
As you have a minimum SDK of 14
(and I think you're not using a ViewPager
?!) it would make sense to use the SDK version of the fragments framework. A FragmentTabHost
is a convenience wrapper around a TabHost
to make working with fragments as tabs easier. I don't recall seeing an equivalent for FragmentTabHost
in the SDK so you would have two options:
TabHost
and implement your own logic to switch the fragments when the tab changesFragmentTabHost
and change it to work with the SDK version of the fragments framework. If I remember right the code for the FragmentTabHost
is fairly simple and a copy-paste followed by changing the imports should work.However, it seems you want to use the FragmentTabHost
with nested fragments(the fragment tabs being part of another bigger fragment), in this case you need to use the fragments from the support library(along with FragmentTabHost
) because the support for nested fragments was introduced in the SDK starting with 4.2
which means that any version between 4.0 and 4.2 will not be able to use nested fragments.