码迷,mamicode.com
首页 > 移动开发 > 详细

设置android状态栏颜色和toolbar颜色一致

时间:2016-05-27 18:18:16      阅读:404      评论:0      收藏:0      [点我收藏+]

标签:


使用:https://github.com/jgilfelt/SystemBarTint
在Activity中:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window win = getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
winParams.flags |= bits;
win.setAttributes(winParams);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.colorPrimary);
}

x.view().inject(this);
}

设置android状态栏颜色和toolbar颜色一致

标签:

原文地址:http://www.cnblogs.com/yshyee/p/5535551.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!