有些时候看到标题懒得颜色和我们设计的软件的颜色不一样,希望通过修改通知栏的颜色为软件的主题颜色,那样看起来就会好很多,
代码如下:
<pre name="code" class="java"><span style="font-size:18px;">/** 更改通知栏颜色 */
SystemBarTintManager mTintManager = new SystemBarTintManager(this);
//使状态栏着色
mTintManager.setStatusBarTintEnabled(true);
//使导航栏着色
mTintManager.setNavigationBarTintEnabled(false);
//设置颜色
int selected = 0x07bda5;
int color = Color.argb(255, Color.red(selected), Color.green(selected),
Color.blue(selected));
mTintManager.setTintColor(color);
}</span>