Search code examples
javaandroidhidestatusbar

Hide and blocked status bar on android


i know that there are many many response about my question , but i precise that i am making application where any interact on status bar are allow. So , i want to hide the status bar. I already use :

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

the status bar disappear at first but when i interact with the view, he come back and i wish it were blocked.

How I do it ?


Solution

  • You should create a fullScreen Acivity i. e. You must add these lines in Your OnCreate method

    requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
    

    and then setContentView(R.layout.MainActivity);