How to disable status bar for a specific app

Viewed 73

I'm developing an Android app. Where I want to disable the status bar, I mean when the app is opened. Then user can't access the status bar from that app. Is it possible?

Thanks.

2 Answers

The android documentation actually covers this. Here's the scratch code, and I've linked the exact page. Ensure you are using the method prescribed for API 16 and higher if you are developing in that. I hope this is what you were looking for.

View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
ActionBar actionBar = getActionBar();
actionBar.hide();

https://developer.android.com/training/system-ui/status

Related