iOS's immersive notification bar is tall, with a unified color or style for the notification bar and app, which is beautiful. Android has already achieved this effect.
I'm also writing a way to implement the notification bar immersion method, which currently only implements the same color.
To change the layout file XML first
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:fitssystemwindows= "true"Android:background= "@color/base_red"android:cliptopadding= "true"android:orientation= "vertical" ></LinearLayout>
Then write the following sentence in the OnCreate method of the activity:
@Overrideprotected voidonCreate (Bundle arg0) {Super. OnCreate (arg0); Setcontentview (R.layout.activity_tabmain); if(Build.VERSION.SDK_INT >= build.version_codes. KITKAT) {//4.4 or more//Transparent status barGetWindow (). Addflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); //Transparent navigation barGetWindow (). Addflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); } }
Only in the 4.4 system above can use ha.
Fragment I didn't try to write directly in the parent activity
Android Immersion Notification bar