Android中状态栏颜色及字体颜色修改

// 设置状态栏字体颜色
        View stateView = getWindow().getDecorView();
         if(stateView != null){
            int vis = stateView.getSystemUiVisibility();
            //vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; //黑色
            vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; //白色
            stateView.setSystemUiVisibility(vis);//设置状态栏字体颜色
        }
         // 修改状态栏背景颜色
        getWindow().setStatusBarColor(getColor(R.color.colorPrimary));

你可能感兴趣的:(Android中状态栏颜色及字体颜色修改)