Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide bottom system bar in android tablet

I am developing an application for tablet only, where the requirement is to run the app on the full screen of the tablet.

For this I have used following code in my main activity:

getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

This code snippet only removes the title bar and action bar. But in tablets, there is a bottom system bar (having home and back button). I also want to remove or hide this system bar too.

I have searched but there is only following solution:

  1. There is no API to remove or hide the system bar.
  2. You can use some android app to hide system bar. (for example: surelock, hidebar, etc)

My question is :

  1. Is it really not possible in android?
  2. Above available app (i.e surelock, hide bar, etc) also hiding bar. It means they are using something to do so. Can be use this something in our app so the user will not require to download these app seperatly.

Please guide me.

I know this is not a good idea. But My app is only for tablet having Android 4.0 or greater and that tablet will run only this single app so we do not need to go back and use home button. That's why my requirement is to use the app in full screen.

like image 986
Manoj Agarwal Avatar asked Apr 17 '13 09:04

Manoj Agarwal


People also ask

How do I get rid of the bottom app bar on Android?

In the SureLock Settings screen, navigate to Miscellaneous Settings. Check Use Advance Hide Bottom Bar option to enable it. Once done, the bottom bar on the device will be hidden.

How do you hide the bar on Android?

On Android 4.1 and higher, you can set your application's content to appear behind the status bar, so that the content doesn't resize as the status bar hides and shows. To do this, use SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN . You may also need to use SYSTEM_UI_FLAG_LAYOUT_STABLE to help your app maintain a stable layout.

How do I hide the bottom bar on my Samsung?

The navigation bar is pinned by default. If you want to view files or use apps in full screen, double-tap the Show and hide button to hide the navigation bar. To show the navigation bar again, drag upwards from the bottom of the screen.


2 Answers

If you have root access you can use this code other wise it is not allowed

try{
    //REQUIRES ROOT
    Build.VERSION_CODES vc = new Build.VERSION_CODES();
    Build.VERSION vr = new Build.VERSION();
    String ProcID = "79"; //HONEYCOMB AND OLDER

    //v.RELEASE  //4.0.3
    if(vr.SDK_INT >= vc.ICE_CREAM_SANDWICH){
        ProcID = "42"; //ICS AND NEWER
    }



    //REQUIRES ROOT
    Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity "+ ProcID +" s16 com.android.systemui"}); //WAS 79
    proc.waitFor();

}catch(Exception ex){
    Toast.makeText(getApplicationContext(), ex.getMessage(), Toast.LENGTH_LONG).show();
}

See this

like image 96
Arun C Avatar answered Oct 04 '22 21:10

Arun C


From Android API 4.0 and later you can use the following code to hide the bottom system bar.

View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
          | View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
like image 25
Samik Bandyopadhyay Avatar answered Oct 04 '22 21:10

Samik Bandyopadhyay