How to make an activity full screen in android studio?

Sanjay S Gangwar
Jan 8, 2021

--

There are several ways to do so, Some of them is given below:

i: Add this method to the activity.java file and call it.

private void fullScreenUI() {
//Full Screen App
View decorView = getWindow().getDecorView();

int uiOptions;

uiOptions = (SYSTEM_UI_FLAG_IMMERSIVE
// Set the content to appear under the system bars so that the
// content doesn't resize when the system bars hide and show.
| SYSTEM_UI_FLAG_LAYOUT_STABLE
| SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
// Hide the nav bar and status bar
| SYSTEM_UI_FLAG_HIDE_NAVIGATION
| SYSTEM_UI_FLAG_FULLSCREEN);

decorView.setSystemUiVisibility(uiOptions);

}

Just Call this Function in any Activity and You are good to go. πŸ‘ŒπŸ‘Œ

ii: Second ways are just adding this item in style.xml

<item name="android:windowFullscreen">true</item>

--

--

Sanjay S Gangwar
Sanjay S Gangwar

Written by Sanjay S Gangwar

0 Followers

Just an average android developer.

No responses yet