Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide ActionBar and NavigationBar after a certain delay time?

I would hide navigation bar and action bar of my app after some second that display don't get touched, and expand current view to fullscreen. Then if user touch the screen (or better if he swipe down), make visible both again. How to?

like image 951
giozh Avatar asked Sep 07 '13 15:09

giozh


People also ask

How do I hide the navigation bar on my Samsung?

It's a nice mixture of Android 9 Pie and Android 10 gestures. Go through the steps below to make changes. Step 1: Open the Settings app on your Samsung device. Step 2: Navigate to the Display > Navigation Bar > Full screen gestures > More options > Swipe from bottom.

How do I Auto Hide navigation bar?

Touch “Settings” -> “Display” -> “Navigation bar” -> “Buttons” -> “Button layout”. Choose the pattern in “Hide navigation bar” -> When the app opens, the navigation bar will be automatically hidden and you can swipe up from the bottom corner of the screen to show it.

How do I hide action bar in one activity?

You can directly hide Action Bar for a specific activity by specifying the NoActionBar theme in its activity tag in the manifest file.


1 Answers

You can use a Handler to delay certain actions.

 Handler h = new Handler();

 h.postDelayed(new Runnable() {

     @Override
     public void run() {
         // DO DELAYED STUFF
         getActionBar().hide();
     }
 }, delaytime); // e.g. 3000 milliseconds

The actions you take inside the run() method will be executed after the delay-time you set.

like image 172
Philipp Jahoda Avatar answered Sep 21 '22 19:09

Philipp Jahoda