Reputation: 553
I have a tablet which is rooted. To hide the navigation as well as the system bar I have the following code in my Activity's onCreate method:
final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LOW_PROFILE;
if(android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
{
getWindow().getDecorView().setSystemUiVisibility(flags);
// Code below is to handle presses of Volume up or Volume down.
// Without this, after pressing volume buttons, the navigation bar will
// show up and won't hide
final View decorView = getWindow().getDecorView();
decorView
.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener()
{
@Override
public void onSystemUiVisibilityChange(int visibility)
{
if((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0)
{
decorView.setSystemUiVisibility(flags);
}
}
});
}
I want to not allow the user the option to pull the System Bar at all. For rooted device. how do I go about it?
Upvotes: 0
Views: 206
Reputation: 22955
Here are two very simple calls to disable and enable the status bar that I have used before. Can be used from the command line
Disable:
service call activity 42 s16 com.android.systemui
Enable:
am startservice -n com.android.systemui/.SystemUIService
Upvotes: 2