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:

  1. create new imageview instance , copy needed parameters (image, background, scaletype, layoutparams, etc.) imageview inflated xml.

or

  1. move imageview original xml (lets name a) separate xml (that contain imageview, lets name b). in a xml use include tag make contain imageview. , in code can inflate "copy" of imageview b xml.

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -