Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 814
Roman Panaget Avatar asked Apr 15 '26 22:04

Roman Panaget


1 Answers

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

like image 80
Marko Avatar answered Apr 17 '26 10:04

Marko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!