Apps Multi Image animation in Android is slow

VKL22

Lurker
I am trying to apply multiple-animation for multiple image views at the same time. Below is the code snippet.

for(int i=0;i<frame.getChildCount();i++){
finalImageView vw =(ImageView) frame.getChildAt(i);
vw.animate().rotationY(45)
.scaleY(0.8f)
.x(0)
.setDuration(600)
.setInterpolator(new DecelerateInterpolator(1.5f))
.withLayer().start();
}

this is applied to every item while swiping. This performance is slow even for 9 or 10 images.

And also

Is there any difference in adding single image 10 times and 10 different images(same dimens,same resolution,same file size) one time for animation.?

Because I added 1 image 10 times and provided multiple animation as like above, while swiping it was quite smooth throughout my interaction. but while adding different images (same dimens,same resolution,same file size) for my process, there is severe lag in animating. Some steps i tried to improve performance

1.Adding Layer type (This improves for one time animating, when the animation is continuous, this is not helping)

2.Tried Setting hardwareaccelerated attribute in Manifest

3.Tried setting large heap attribute in manifest

4.Added animation cache for items.

5.Tried running with high RAM devices.

Do we have any options to improve animation performance.?

a rough sample of the implementation has been uploaded as sample. Please check and let me know for any help.
 

Attachments

  • SlideImage.zip
    1.3 MB · Views: 34
Top