Adding a color filter to a Drawable changes all Buttons using the same Drawable
<p>I have a screen where multiple Buttons use the same background Drawable. I have reusable code I use in various projects to add an OnTouch listener that adds a gray color filter while a button is being touched. That usually works fine, but in this case ALL the buttons are tinted when any of them is pressed.</p>

<p>I see an explanation in <a href="http://developer.android.com/guide/topics/graphics/2d-graphics.html" rel="nofollow">http://developer.android.com/guide/topics/graphics/2d-graphics.html</a>:</p>

<pre><code>Note: Each unique resource in your project can maintain only one state, no matter how many different objects you may instantiate for it. For example, if you instantiate two Drawable objects from the same image resource, then change a property (such as the alpha) for one of the Drawables, then it will also affect the other.
</code></pre>

<p>The suggested solution is to use a TweenAnimation, which does not seem to work with color filters.</p>

<p>I also saw <a href="http://stackoverflow.com/questions/7979440/android-cloning-a-drawable-in-order-to-make-a-statelistdrawable-with-filters">Android: Cloning a drawable in order to make a StateListDrawable with filters</a> which suggests using drawable.getConstantState().newDrawable(). This does not seem to make a difference. I'm guessing that as long as the same physical image file is used, all Drawables will be affected by a change to any other Drawable using the same resource.</p>

<p>What solution is there, other than creating a second background image to show the pressed state? It would be nice to have a simple programmatic solution I can add to my code and use in every project.</p>
