Android 给App设置默哀色(黑白化)

在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);
    }

你可能感兴趣的:(Android 给App设置默哀色(黑白化))