private void setupTint() {
   SystemBarTintManager tintManager = new SystemBarTintManager(this);
   tintManager.setStatusBarTintEnabled(true);
   tintManager.setStatusBarTintColor(getResources().getColor(R.color.red));
   tintManager.setNavigationBarTintEnabled(true);
   tintManager.setNavigationBarTintColor(getResources().getColor(R.color.red));
 }
 private void adjustSystemBarTintAsNeeded()
 {
   if (Build.VERSION.SDK_INT == 19)
   {
     SystemBarTintManager localSystemBarTintManager = new SystemBarTintManager(this);
     localSystemBarTintManager.setStatusBarTintEnabled(true);
     localSystemBarTintManager.setTintColor(getResources().getColor(R.color.primaryDark));
     localSystemBarTintManager.setStatusBarTintColor(getResources().getColor(R.color.primaryDark));
   }
 }
Example #3
0
 @TargetApi(19)
 public static void setTranslucentStatusBar(Activity activity, NavigationView navigationView) {
   if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT && navigationView != null) {
     // fix 天坑 4.4 + drawerlayout + navigationView
     tianKeng(activity, activity.getResources().getColor(R.color.primary), navigationView);
   } else {
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
       activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
       SystemBarTintManager tintManager = new SystemBarTintManager(activity);
       tintManager.setStatusBarTintEnabled(true);
       tintManager.setStatusBarTintColor(activity.getResources().getColor(R.color.primary));
     }
   }
 }