Android APP黑白化

默哀色0.0
在onCreate方法中调用

Paint paint = new Paint();
ColorMatrix cm = new ColorMatrix();
//设置色彩饱和度,当饱和度为0,即黑白色
cm.setSaturation(0);
//将饱和度为0的颜色过滤器设置在画笔
paint.setColorFilter(new ColorMatrixColorFilter(cm));
//getWindow().getDecorView() is the top-level window decor view;
//View.LAYER_TYPE_HARDWARE 硬件加速
getWindow().getDecorView().setLayerType(View.LAYER_TYPE_HARDWARE, paint);

你可能感兴趣的:(Android APP黑白化)