0

I'm building an app that uses tabs with a viewpager and fragments. However, when the user selects an actionbar item, it should show a fragment inside the View where the tabs are displayed.

I tried adding an extra item to the viewpager(For the extra fragment to be displayed), and setting the selected item in the viewpager to the extra fragment when the action item is clicked, it did show the extra fragment, but the last tab remains active below that fragment. Is there any other way to show an arbitrary fragment within the area for the tabs?

Nico Griffioen
  • 5,143
  • 2
  • 27
  • 36
  • Please post your code, specially let us know how you "show" the fragments. Thanks. – fasteque Jan 16 '14 at 10:47
  • I was basically the standard way android handles tabs with fragments, taken from the android site. In the end I solved it by using containerfragments taken from [this question](http://stackoverflow.com/questions/18120510/dynamically-changing-the-fragments-inside-a-fragment-tab-host), with the following modifications: - Disable the indicator on the tabs using styles - Use a custom view on the tabs to show when a tabs is selected. - Use a container fragment for the first tab, set that tab as active when I want to display a custom fragment, set an unselected custom view for that tabs. – Nico Griffioen Jan 20 '14 at 00:24

0 Answers0