Android Studio screen settings

135 views Asked by At

Hi guys i'm a beginner on android studio, I noticed that when I run my app on my phone, the status bar and also the on-screen buttons are visible but on my friend's device there is no status bar or on-screen buttons so it uses the full resolution, how can i force the app to have both on all devices? The resolution for my phone and his phone is the same (1080x2340) but on his phone it's like it just zooms out. Is there a way to set the app to work the same on both devices? I mean, the resolution is the SAME but the app looks different because of status bar/on-screen buttons.

1

There are 1 answers

0
Tiyclem On BEST ANSWER
private void hideSystemUI() {
    // Set the IMMERSIVE flag.
    // Set the content to appear under the system bars so that the content
    // doesn't resize when the system bars hide and show.
    mDecorView.setSystemUiVisibility(
            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 // hide nav bar
            | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
            | View.SYSTEM_UI_FLAG_IMMERSIVE);
}

// This snippet shows the system bars. It does this by removing all the flags
// except for the ones that make the content appear under the system bars.
private void showSystemUI() {
    mDecorView.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}