在Material Design的指导中,状态栏应该比动作栏更暗?我在运行时为操作栏设置了一个颜色集,并且无法在编程时知道这种颜色,那么如何才能获得正确的状态栏颜色?
我知道我可以用它来变暗颜色
this.getSupportActionBar().setBackgroundDrawable(new ColorDrawable(colorPrimary));
float[] hsv = new float[3];
Color.colorToHSV(colorPrimary, hsv);
hsv[2] *= 0.8f;
int colorPrimaryDark = Color.HSVToColor(hsv);
if(Build.VERSION.SDK_INT>=21)
Chat.this.getWindow().setStatusBarColor(colorPrimaryDark);
Run Code Online (Sandbox Code Playgroud)
但我不确定它会变暗多少