Android4.4新的特性,在应用内开启透明状态栏和透明虚拟按钮
一:Immersive full-screen mode
To provide your app with a layout that fills the entire screen, the new SYSTEM_UI_FLAG_IMMERSIVE
flag forsetSystemUiVisibility()
(when combined withSYSTEM_UI_FLAG_HIDE_NAVIGATION
) enables a newimmersive full-screen mode. While immersive full-screen mode is enabled, your activity continues to receive all touch events. The user can reveal the system bars with an inward swipe along the region where the system bars normally appear. This clears the SYSTEM_UI_FLAG_HIDE_NAVIGATION
flag (and theSYSTEM_UI_FLAG_FULLSCREEN
flag, if applied) so the system bars remain visible. However, if you'd like the system bars to hide again after a few moments, you can instead use the SYSTEM_UI_FLAG_IMMERSIVE_STICKY
flag.
二:Translucent system bars
You can now make the system bars partially translucent with new themes, Theme.Holo.NoActionBar.TranslucentDecor
andTheme.Holo.Light.NoActionBar.TranslucentDecor
. By enabling translucent system bars, your layout will fill the area behind the system bars, so you must also enable fitsSystemWindows
for the portion of your layout that should not be covered by the system bars.
If you're creating a custom theme, set one of these themes as the parent theme or include thewindowTranslucentNavigation
andwindowTranslucentStatus
style properties in your theme.