0
我可以將顏色過濾器應用於繪圖板,但指定我想要的顏色的顏色?例如:我的drawable結果是兩個正方形的組合,一個正方形是紅色(#FF0000),另一個正方形是藍色(#0000FF)。我想要一個函數返回一個Drawable,我通過現有的顏色,我想改變和我想要應用的新顏色。我怎麼看它Android - 可繪製,將顏色過濾器應用於特定顏色
代碼示例:
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
如何我EffectFactory工作?你會推薦哪種方法,在文檔列表中,似乎沒有任何東西符合我的需求 – Bugdr0id