0

我想创建一个可以将视图颜色更改为绿色和白色的滤色器。

Paint paint = new Paint();
float[] mx = {
                0, 0, 0, 0, 0,
                0, 0, 1, 0, 0,
                0, 0, 0, 0, 0,
                0, 0, 0, 0, 255
        };

paint.setColorFilter(new ColorMatrixColorFilter(mx));
webView.setLayerType(View.LAYER_TYPE_HARDWARE, paint);

这是我正在使用的代码。一切正常,但我的白色变成绿色,但我希望我保持白色。

4

1 回答 1

0

解决了

float[] mx = {
                 1, 0, 0, 0, 0,
                 1, 1, 1, 1, 0,
                 1, 0, 0, 0, 0,
                 0, 0, 0, 0, 255
        };
于 2019-08-26T07:26:34.550 回答