Android--动态改变ImageView的亮度

//改变图片的亮度方法 0--原样  >0---调亮  <0---调暗
    private void changeLight(ImageView imageView, int brightness) {
        ColorMatrix cMatrix = new ColorMatrix();
        cMatrix.set(new float[] { 1, 0, 0, 0, brightness, 0, 1, 0, 0,
                brightness,// 改变亮度
                0, 0, 1, 0, brightness, 0, 0, 0, 1, 0 });
        imageView.setColorFilter(new ColorMatrixColorFilter(cMatrix));
    }

 

posted @ 2016-01-15 08:47  灬布衣丶公爵丨  阅读(1640)  评论(0编辑  收藏  举报