SystemBarTint项目地址:https://github.com/jgilfelt/SystemBarTint

使用:

public class BaseActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        initStatusBar();    }    @Override    protected void onDestroy() {        super.onDestroy();        ButterKnife.unbind(this);    }    private void initStatusBar() {        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {            setTranslucentStatus(true);        }        SystemBarTintManager tintManager = new SystemBarTintManager(this);        tintManager.setStatusBarTintEnabled(true);        tintManager.setNavigationBarTintEnabled(true);        tintManager.setStatusBarTintColor(getResources().getColor(R.color.colorPrimaryDark));    }    @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);    }}

更多相关文章

  1. android studio基本使用零碎整理
  2. Android之TabHost的几种使用方法
  3. Android(安卓)VelocityTracker使用总结
  4. 直播源码用Glide框架缓存压缩图片做一个网络图片查看器
  5. Android中OptionMenu的使用
  6. Android|Smaller apk
  7. 箭头函数的基础使用
  8. NPM 和webpack 的基础使用
  9. Python list sort方法的具体使用

随机推荐

  1. Activity的启动
  2. Android 学习之 SQLite操作
  3. Ubuntu环境下下载编译Android kernel源码
  4. Android源码阅读分析:从Activity开始(一)—
  5. Android ViewPager多页面滑动切换以及单
  6. 关于ADT(eclipse android)项目迁移到Androi
  7. Android O新特性系列
  8. xmlns:android和xmlns:mi
  9. android实现通知栏下载更新app示例
  10. Android实现语音识别代码