Android4 4 5 0沉浸式狀態列

2021-07-10 16:14:18 字數 1001 閱讀 7946

5.0以上效果如下:

* 安卓5.0以上版本設定狀態列顏色配合如下兩條屬性使用

* android:cliptopadding="true"

* android:fitssystemwindows="true"

* @param activity

*/public static void setlopstatbar(activity activity, int color)

}/**

* 狀態列半透明 4.4 以上有效配合如下兩條屬性使用

* android:cliptopadding="true"

* android:fitssystemwindows="true"

** @param activity

*/public static void initsystembar(activity activity)

systembartintmanager tintmanager = new systembartintmanager(activity);

tintmanager.setstatusbartintenabled(true);

// 使用顏色資源

tintmanager.setstatusbartintresource(r.color.blue);

}@targetapi(19)

private static void settranslucentstatus(activity activity, boolean on) else

win.setattributes(winparams);

}在activity的oncreate方法中呼叫即可

Android 沉浸式 體驗

首先宣告一下這個叫法應該是不對的,translucent翻譯過來的是半透明效果,不是ios的那種什麼沉浸式 首先要明確1個概念,在android上,沉浸式 叫沉浸式全屏模式以及透明化系統狀態列其實這個也沒啥好說的,不管你是android粉還是ios粉,在日常玩機的過程中,都見過這種介面效果 強調一下...

Android 沉浸式模式

注意.沉浸式模式是android4.0後出現的,所以在使用的時候注意這一點。1.為保障每個頁面都使用的是沉浸式狀態列,統一風格,所以我們需要建立theme 2.在res目錄下建立values v19 style.xml 3.新增如下屬性 windownotitle 代表沒有標題欄windowistr...

Android 沉浸式體驗

1 平時我們寫 的習慣都會在專案中設定乙個baseactivity,用來實現一些activity的共有操作,此時正好用到 再baseactivity中的布局中新增乙個20dp的view 狀態列的高度一般就是20dp view的背景色就設定為你的標題欄顏色 2 在baseactivity中將狀態列設定...