Android make a copy of an ImageView instance -
i have imageview laid out in xml, need later programmatically add overlay images first. wondering if there easy way make new imageview instance based on 1 have? way don't need reset layout constraints , whatnot.
i suspect there isn't simple way this, thought throw question out there.
there's no simple way that. can either:
- create new
imageviewinstance , copy needed parameters (image,background,scaletype,layoutparams, etc.)imageviewinflated xml.
or
- move
imagevieworiginal xml (lets namea) separate xml (that containimageview, lets nameb). inaxml useincludetag make containimageview. , in code can inflate "copy" ofimageviewbxml.
Comments
Post a Comment