Android 给App设置默哀色(黑白化)
2022-11-30 本文已影响0人
冬絮
在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);
}