简体   繁体   中英

android notification bar show/hide toggle

I am making an app where I would like the notification bar to be toggled for being show/ not being shown. Is that possible? I already know how to set button listener/override buttons but I just need the java code that makes that possible. Thanks

// Get a full-screen window
final Window win = getWindow();
win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);

Be aware that:

Note that some flags must be set before the window decoration is created (by the first call to setContentView(View, android.view.ViewGroup.LayoutParams) or getDecorView()

From http://developer.android.com/reference/android/view/Window.html#setFlags(int,%20int )

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