How to Implement Full Screen Mode Using Android APIs

From wizarPOS
Revision as of 08:31, 13 December 2021 by Mahong (talk | contribs)

To hide the status bar and navigation bar, Android provides immersive mode. In this way, third-party applications can achieve full screen. But use Android method, it still can pull-down to show the status bar and the notice messages, so we use the permission to enhance the function, after add the permission, the status bar can not show when pull-down.

Permission

 android.permission.CLOUDPOS_REAL_FULLSCREEN

The application declares permissions in the manifest.

Code snippet

//statusBar,navigationBar are all not display
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN);

//statusBar is display, navigationBar is not display
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_VISIBLE);

Download

Please download the whole demo.