3
StateListDrawable
은 포함하고있는 드로어 블에 적용된 컬러 필터를 무시합니다. 예를 들면 :StateListDrawable의 특정 드로어 블에 컬러 필터를 적용하는 방법은 무엇입니까?
StateListDrawable sld = new StateListDrawable();
Drawable pressedState = Context.getResources().getDrawable(R.drawable.solid_green);
pressedState.setColorFilter(Color.RED, PorterDuff.Mode.SRC);
sld.addState(new int[] {android.R.attr.state_pressed}, pressedState);
// Other states...
당신이보기의 배경에 sld
을 적용하면, 당신이 그것을 누를 때 뷰의 배경이 빨간색으로 설정하는 기대. 대신 필터가 적용되지 않은 pressedState
의 색이 초록색으로 변합니다.