简体   繁体   中英

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 ?

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

This happens because android is rebuilding views onchange (see the application lifecycle)
I would recommend you to define it in the manifest like this:

<activity
    android:name="yourActivityName"
    android:label="your label"
    android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen" >

</activity>

You should create a fullScreen Acivity ie 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM