2014-12-05 37 views
0

所以我想在運行時着色一些Drawable,以實現這一點我使用自定義資源類來返回繪製有色。色調一個可繪製的前棒棒糖

喜歡的東西:

public final class MyResources extends Resources 
{ 
    public Drawable getDrawable(int resId) throws NotFoundException { 
     Drawable drawable = super.getDrawable(resId); 
     drawable.setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN); 
     return drawable; 
    } 
} 

當繪製設置爲小部件,在這樣的EditText一些小部件,按鈕繪製突變和過濾器丟失。

真正的代碼是:https://github.com/SiegenthalerSolutions/QuantumPaper/blob/master/library/src/main/java/me/siegenthaler/quantum_paper/QuantumResources.java

,我想什麼是防止設置第二次繪製:(hackish的)

https://github.com/SiegenthalerSolutions/QuantumPaper/blob/master/library/src/main/java/me/siegenthaler/quantum_paper/interceptor/SimpleBackgroundInterceptor.java

回答