How to show/hide Actionbar when clicked on

ymerdrengene picture ymerdrengene · Mar 10, 2013 · Viewed 10.7k times · Source

When the user clicks anywhere on the screen, I want the Actionbar to hide and when pressed again it should reappear.

I know there is something called actionbar.hide(); and show, but can you please help me how to implement it? :)

Answer

Raghav Sood picture Raghav Sood · Mar 10, 2013

Just hide():

getActionBar().hide();

when you want to hide it, and use show():

getActionBar().show() 

when you want to show it. That's about it.

Remember that if you're using View.SYSTEM_UI_FLAG_FULLSCREEN, this will not work properly.