/**
* 设置View的灰度
*/
public static void setGreyscale(View v, boolean greyscale) {
if (greyscale) {
// Create a paint object with 0 saturation (black and white)
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
Paint greyscalePaint = new Paint();
greyscalePaint.setColorFilter(new ColorMatrixColorFilter(cm));
// Create a hardware layer with the greyscale paint
v.setLayerType(LAYER_TYPE_HARDWARE, greyscalePaint);
} else {
// Remove the hardware layer
v.setLayerType(LAYER_TYPE_NONE, null);
}
}
ResUtil.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:RLibrary
作者:
评论列表
文章目录