置灰前
置灰后
給Activity的頂層View設(shè)置置灰刃宵,實現(xiàn)全局置灰效果牲证。獲取界面的根View:
View view = getActivity(). getWindow(). getDecorView();
Paint paint = new Paint();
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
paint.setColorFilter(new ColorMatrixColorFilter(cm));
view. setLayerType(View.LAYER_TYPE_HARDWARE, paint);