Android - Drawable,将滤镜应用于特定颜色

时间:2015-11-03 16:39:01

标签: android colors paint android-drawable

我可以将彩色滤镜应用于可绘制的但指定我想要着色的颜色吗?

示例:我的结果drawable是两个正方形的组合,一个正方形是红色(#FF0000),另一个正方形是蓝色(#0000FF)。我想要一个返回Drawable的函数,我传递现有的颜色,我想要改变它,并且我想要应用新的颜色。

我如何看待它的代码示例:

private Drawable switchColorOnDrawable(Drawable mySquares, int existingColor, int replaceColor){
    //mySquare -> represents my image
    //existingColor -> the color I do want to switch
    //replaceColor -> the new color that should be replaced

    //TODO -> ???

    return mySquares;
}

修改:最低SDK版本= 17

1 个答案:

答案 0 :(得分:0)

绝对可以!这只是一个问题!由于我更喜欢​​更简单的方法,我会选择EffectFactory或Adobe创意云SDK,两者都很好,但却以自己的方式区分。退房:

相关问题