Deep copy of a Drawable

前端 未结 4 779
旧时难觅i
旧时难觅i 2020-12-06 09:16

I have an ImageView. In its onClick I get its Drawable:

Drawable dr = ((ImageView) v).getDrawable();

And set it to a dialog\'s ImageView:

4条回答
  •  粉色の甜心
    2020-12-06 10:09

    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();
    

提交回复
热议问题