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获取移动设备的IP地址
  2. Android Studio : 导入项目出现 peer not authenticated 错误
  3. android 项目收获01
  4. Android 项目代码混淆
  5. android studio 3.6.1导入项目报错(无法下载classpath里的内容)
  6. Android studio升级3.0.1之后原项目签名打包出错
  7. Android获取物理地址(支持5.0~10.0)
  8. Android Studio 关联项目软链接
  9. eclipse android 项目报错 ERROR: Unable to open class file

随机推荐

  1. Android(安卓)改变标题栏的背景色
  2. android 升级 4.1后出现java.lang.NoSuch
  3. android系统中自带的图标大全
  4. Android(安卓)Studio 无法打开虚拟机
  5. android > WebView > 布局
  6. Android(安卓)& Vibrator
  7. Android版本下载以及切换
  8. 导航
  9. Android使用AchartEngine绘制曲线图
  10. Android原生和H5交互;Android和H5混合开发