Roman Panaget
Roman Panaget

Reputation: 2428

Android - Tabbed Fragment

I am developping an app with an activity which switches between a few fragments. I was wondering if it is possible to have one of this fragment with tabs in the action bar, but not the other ones, knowing that, in general, the activity is tabbed and the tabs switch between fragments. In a nutshell, I want an activity with a few fragments, and one of this fragments should have tabs to browse between other fragments, is that possible?

Upvotes: 3

Views: 146

Answers (2)

velocity_distance
velocity_distance

Reputation: 88

Nice post Marko! I was just typing up basically the same answer. Here is a link for the documentation on Nested Fragments hope that helps as well

Upvotes: 2

Marko
Marko

Reputation: 20513

Ofcourse it is possible, take a look around StackOverflow, there are a couple of questions already.

Instead of normal TabHost your should use FragmentTabHost and because you will have fragments inside a fragment, you will have to use getChildFragmentManager() instead of getFragmentManager().

Adding tab inside fragment

Upvotes: 2

Related Questions