Trying to reuse ImageView in Android
I am attempting to reuse ImageView
objects in a RelativeLayout
to avoid the cost of memory allocation. Specifically I create an ImageView
programatically, and associate a fade animatiom with it. The animation runs and in onAnimationEnd()
I set visibility to GONE
and push the ImageView
on a queue. When I next want to repeat this process开发者_Go百科 I look to see if there is an ImageView
on the queue and if so use this instead of requesting a new one. There is quite a delay between these uses so the animation is definitely done and dusted. The problem is that whilst the reused view will accept new ImageResource
, I cannot get it to accept new RelativeLayout.LayoutParams
to set the view to a different position in the layout! Any help much appreciated
精彩评论