How to set alpha value for drawable in a StateListDrawable?
问题 I want to change a drawable's alpha value when it is pressed. So I create two drawables and put them in a StateListDrawable and set the alpha value for the pressed state. But it just doesn't work. StateListDrawable content = new StateListDrawable(); Drawable contentSelected = this.getResources().getDrawable( R.drawable.content_background); contentSelected.mutate().setAlpha(100); Drawable contentNormal = this.getResources().getDrawable(R.drawable.content_background); content.addState(new int[]