在BaseActivity的onCreate方法中判断是否需要黑白化,然后调用该方法
private void blackAndWhiteMode(){
Paint mPaint = new Paint();
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
mPaint.setColorFilter(new ColorMatrixColorFilter(cm));
getWindow().getDecorView().setLayerType(View.LAYER_TYPE_HARDWARE, mPaint);
}
网友评论