新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
如何在Android開發(fā)中設(shè)置沉浸式布局-創(chuàng)新互聯(lián)
本篇文章給大家分享的是有關(guān)如何在Android開發(fā)中設(shè)置沉浸式布局,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

先導(dǎo)入該包,進(jìn)行 系統(tǒng)systemBar 管理
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
在BaseActivity中添加 該 字段;
public class BaseActivity extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
setTranslucentStatus(true);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.my_red);//通知欄所需顏色
}
super.onCreate(savedInstanceState);
this.activity = this;
}
@TargetApi(19)
private void setTranslucentStatus(boolean on) {
Window win = getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
}
}以上就是如何在Android開發(fā)中設(shè)置沉浸式布局,小編相信有部分知識點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
網(wǎng)頁名稱:如何在Android開發(fā)中設(shè)置沉浸式布局-創(chuàng)新互聯(lián)
文章位置:http://www.dlmjj.cn/article/jjses.html


咨詢
建站咨詢
