Hide/show Action Bar in Android activity

7.6k Views Asked by At

I have an android activity extended from ActionBarActivity.

My Activity content ruled by state pattern. When state changes, screen also changes somehow. I need ActionBar just in one of 3 states I have. How can I hide ActionBar by default and show it only in one State of my Activity?.

Thanks in advance!

2

There are 2 best solutions below

2
Nikhil On BEST ANSWER

For hiding use

getSupportActionBar().hide();

and for Showing it again use

getSupportActionBar().show(); 
0
Nowshad On

look at this example its work for me by default i hide my action bar layout after that i am showing it on user data requirements

How to hide and show action bar