ImageView iv = new ImageView(this);
Drawable drawable = getResources().getDrawable(R.drawable.icon);
drawable.mutate();
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
ColorMatrixColorFilter cf = new ColorMatrixColorFilter(cm);
drawable.setColorFilter(cf);
iv.setImageDrawable(drawable);
setContentView(iv);[img]http://dl.iteye.com/upload/attachment/573955/91e79031-bc3f-3f68-97d8-4bfe711ea886.jpg[/img]
本文介绍了如何通过Android中的ColorMatrix和ColorMatrixColorFilter类来调整图片的饱和度,提供了代码示例并展示了调整前后图片效果的对比。

被折叠的 条评论
为什么被折叠?



