4
這段代碼有什麼問題?我一直在掙扎着爬dwb2 ColorFiltered幾個小時,它只是顯示時按下此按鈕:(setColorFilter()和可變的drawables
public ButtonEx(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
Drawable dwb = getResources().getDrawable(R.drawable.mainboard_btn_pen_colour);
Drawable dwb2 = new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.mainboard_btn_extra_time1)
.copy(Bitmap.Config.ARGB_8888, true));
dwb2.setColorFilter(getResources().getColor(R.color.mod_selected), PorterDuff.Mode.MULTIPLY);
mLstDrawables.addState(new int[] {android.R.attr.state_pressed}, dwb2);
mLstDrawables.addState(StateSet.WILD_CARD, dwb);
setBackgroundDrawable(mLstDrawables);
}