Search code examples
androidbuttontabactivitytabwidget

Android Show/Hide Tabwidget On button Click


Hey can we hide/show tab layout on button click which will be placed below the tab widget it self.

Eg :

enter image description here

When i try to hide - setVisible(View.GONE) the tabwidget whole screens goes black.


Solution

  • The most straightforward way to me would just use the android menu as the way to choose between different tabs instead of a real tab view. When the user clicks on a menu button, you load another activity and the menu gets hidden again.

    The tabhost is meant to stay there throughout the entire app lifecycle. Using it like this would be wrong. A way to achieve this using the tab would be to set it completely invisible and then load the activity that normally is in the tab on the whole screen.