简单实现沉浸式状态栏
2017-09-18 11:26
148 查看
public static void MyWi(Activity activity){
Window window = activity.getWindow();
// 对SDK版本进行判断,大于19执行此代码
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//透明状态栏
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//透明导航栏
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
// 激活状态栏
tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint 激活导航栏
tintManager.setNavigationBarTintEnabled(true);
//设置系统栏设置颜色
//tintManager.setTintColor(R.color.red);
//给状态栏设置颜色
tintManager.setStatusBarTintResource(R.color.umeng_comm_green);//在colors里添加自定义颜色
//Apply the specified drawable or color resource to the system navigation bar.
//给导航栏设置资源
tintManager.setNavigationBarTintResource(R.color.umeng_comm_green);
}
}
更多0
Window window = activity.getWindow();
// 对SDK版本进行判断,大于19执行此代码
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//透明状态栏
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//透明导航栏
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
// 激活状态栏
tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint 激活导航栏
tintManager.setNavigationBarTintEnabled(true);
//设置系统栏设置颜色
//tintManager.setTintColor(R.color.red);
//给状态栏设置颜色
tintManager.setStatusBarTintResource(R.color.umeng_comm_green);//在colors里添加自定义颜色
//Apply the specified drawable or color resource to the system navigation bar.
//给导航栏设置资源
tintManager.setNavigationBarTintResource(R.color.umeng_comm_green);
}
}
更多0
相关文章推荐
- 沉浸式状态栏效果的简单实现
- 4.4系统让App最简单的实现沉浸式状态栏
- Android 沉浸式状态栏 实现方式二 ( 更简单 )
- android沉浸式状态栏简单实现
- 简单使用style实现沉浸式状态栏
- Android 设置全屏沉浸式透明状态栏的工具类(超级简单,两步实现)
- Android——实现简单沉浸式状态栏
- Android 沉浸式状态栏 实现方式二 ( 更简单 )
- Android_简单实现沉浸式状态栏
- Android沉浸式的状态栏的简单实现
- Android 沉浸式状态栏的简单实现
- android沉浸式状态栏的最简单实现
- 沉浸式状态栏(修改状态栏)颜色的简单实现
- 沉浸式状态栏简单实现
- Android沉浸式状态栏简单实现
- Android沉浸式状态栏的简单实现
- android 最简单实现沉浸式状态栏
- Android沉浸式状态栏的简单实现
- android沉浸式状态栏的实现
- Android 5.0及以上系统实现沉浸式状态栏