Android status bar Transparent (immersive effect) default effect
Immersive effects
Mode One source code
(Android Studio project): http://download.csdn.net/detail/q4878802/9058275
1. Modify the status bar and navigation bar properties to be transparent
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { //透明状态栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); //透明导航栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);}
and found the top and bottom are transparent, the view occupies the entire screen position, and the titlebar position is not moving
2. Keep the displayed view to its own size
To add a property on the root node of the view's XML
android:clipToPadding="true"android:fitsSystemWindows="true"
3. Hide TitleBar
Modify Application Theme
android:theme="@android:style/Theme.Black.NoTitleBar"
Test Toast shape
See post someone said this way toast will shape, I tested it, no shape.
Mode two source code
(Android Studio project): http://download.csdn.net/detail/q4878802/9058365
1. Modify the theme
Modify the theme of application
android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar.TranslucentDecor"
Or
android:theme="@android:style/Theme.Holo.Light.NoActionBar.TranslucentDecor"
Or
android:theme="@android:style/Theme.Holo.NoActionBar.TranslucentDecor"
2. Keep the displayed view to its own size
To add a property on the root node of the view's XML
android:clipToPadding="true"android:fitsSystemWindows="true"
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. All articles, any technical point, whether original or reproduced, are used in the program or demo test before publishing! Bo Master qq:4878802.
Android status bar Transparent (immersive effect)