android 把状态栏的图标设置成黑色(白色)

设置方法:

public void changStatusIconCollor(boolean setDark) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
        View decorView = getWindow().getDecorView();
        if(decorView != null){
            int vis = decorView.getSystemUiVisibility();
            if(setDark){
                vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            } else{
                vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            }
            decorView.setSystemUiVisibility(vis);
        }
    }
}
true:黑色
false:白色

你可能感兴趣的:(android 把状态栏的图标设置成黑色(白色))