Android: Cloning a drawable in order to make a StateListDrawable with filters
问题 I'm trying to make a general framework function that makes any Drawable become highlighted when pressed/focused/selected/etc . My function takes a Drawable and returns a StateListDrawable, where the default state is the Drawable itself, and the state for android.R.attr.state_pressed is the same drawable, just with a filter applied using setColorFilter . My problem is that I can't clone the drawable and make a separate instance of it with the filter applied. Here is what I'm trying to achieve: