Given:
- A number of images (10 - 15) residing in assets folder (as practice shows, the better approach is to keep high-resolution images in assets)
- Android UI thread (caching drawables in advance is already made in a background thread)
The issue:
Need to display all the images one on another smoothly and not blocking UI thread after the images are drawn.
Already used approaches:
- Dynamically create a required number of
ImageView
and then call.setImageDrawable()
. This takes a lot of time but the worst thing is that the UI thread is being blocked even after all the images are drawn on theirImageView
. - Create a
LayerDrawable
object and pass as argument an array of the requiredDrawable
s. Then put it on anImageView
also by calling.setImageDrawable()
. This option behaves the same like the one described above.
Is there a way to solve this issue? Or Android devices not capable to cope with it?
If you are requiring a smooth transition between images, please try viewFlipper https://developer.android.com/reference/android/widget/ViewFlipper.html
Basically you can add imageView inside the viewflipper and start animation to move from previous to next image. I am not sure if you need user interactions like scrolling or not. You can try viewPager if user need to scroll betweens images.
Please note that Glide does provide some transition effects for switching between placeholder and image to display. But transition between images are not included, you can have a look here http://bumptech.github.io/glide/doc/transitions.html
I hope this helps because i am not sured that if you are asking the transition between images or rendering images.