Home > Mobile >  Disable status bar android
Disable status bar android

Time:09-12

Hi i want disable the status bar in an java app android, like when the user pull down the bar doesnt go down

CodePudding user response:

Hello bro use This one!

Use this code for hiding the status bar in your app and easy to use

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

CodePudding user response:

If what u want is full screen activity, use this

public class sample extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setFullScreen();

        //add your code

    }

    private void setFullScreen() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R){
            getWindow().getInsetsController().hide(WindowInsets.Type.statusBars() | WindowInsets.Type.statusBars());
            getWindow().getInsetsController().setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
        }else {
            getWindow().setFlags(LayoutParams.FLAG_FULLSCREEN,LayoutParams.FLAG_FULLSCREEN);
        }
    }
}

If you're saying that u don't status bar to open, then that isn't possible.

  • Related