Deep copy of a Drawable
Finally I succeed! I had similar problem, when I used color filter on my drawable it changed the drawable, its very close to the solution of the other people here, but only this worked for me:
Drawable drwNewCopy = dr.getConstantState().newDrawable().mutate();
Use BitmapFactory to convert the drawable into bitmap separately make or perform changes on it.
I managed to copy the drawable using following code:
drawable.mutate().getConstantState().newDrawable();
Here mutate()
makes the drawable mutable to avoid sharing its state, and getConstantState().newDrawable()
creates a new copy.
Thus different ImageView
s use different drawables and there's no stretching.