0

I'm working on a Android project that has a TabHost with four main tabs which each have a corresponding Fragment.

[ Tab 1 ] [ Tab 2 ] [ Tab 3 ] [ Tab 4 ]

As an additional feature I would like to add a nested TabHost to [ Tab 3 ]:

[ Subtab 1 ] [ Subtab 2 ]

Each Subtab has a corresponding Fragment as well.

I've successfully done this but I'm having some very strange behavior. [ Subtab 1 ] and [ Subtab 2 ] both have their own unique menu items and when I switch from [ Tab 3 ] in either Subtab to a different main Tab, the Subtab's menu items stay in the navigation bar.

Am I missing something obvious? Do I need to wire up [ Tab 3 ] to specifically release these menu items or something similar?

Alex Crist
  • 1,059
  • 2
  • 12
  • 22

1 Answers1

0

I was able to find an answer here: https://stackoverflow.com/a/24017261/4762063

The work around is to conditionally inflate the Fragment's menu, only if the Fragment is visible.

Community
  • 1
  • 1
Alex Crist
  • 1,059
  • 2
  • 12
  • 22