开发者

Trying to reuse ImageView in Android

开发者 https://www.devze.com 2023-03-28 12:15 出处:网络
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 a

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

0

精彩评论

暂无评论...
验证码 换一张
取 消