简体   繁体   中英

Android hide status bar, compatibility

I have the following code to hide the status bar taken from http://developer.android.com/training/system-ui/status.html and Hide status bar android

    //hide statut bar
    if (Build.VERSION.SDK_INT < 16) { //ye olde method
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else { // Jellybean and up, new hotness
        View decorView = getWindow().getDecorView();
        // Hide the status bar.
        int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
        // Remember that you should never show the action bar if the
        // status bar is hidden, so hide that too if necessary.
        ActionBar actionBar = getActionBar();
        actionBar.hide();
    }

I get an error on View.SYSTEM_UI_FLAG_FULLSCREEN ;

it seems that SYSTEM_UI_FLAG_FULLSCREEN doesn't exist anymore in View.

How to fix it? please thanks you

It exists since API16. You must build your app against API16 (or higher)

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