I've a RecyclerView with list of imageviews in it. I want to randomly change the image in the ImageView after every few seconds and image should slide in from any direction while exiting the previous image to the other direction (kind of a slide show). Currently, I'm using Glide transition but it does half of the work, it translates the view from left or right but doesn't give effect of exiting the previous image. My question is that is it possible by using only single ImageView or i need to use more than one imageviews or a ViewPager instead?
Asked
Active
Viewed 91 times
0
-
1use `ImageSwitcher` – pskink Sep 15 '18 at 14:42
-
Thanks. I'm using databinding and loading image with Glide, how will it work with that? if i set data factory on each imageUrl change then won't it be expensive task? – Usman Rana Sep 15 '18 at 15:03
-
I've explored it and it is really nice widget but the output is same like using Glide transition because it is still not showing 2 images together, i entering and other exiting. Any idea? – Usman Rana Sep 15 '18 at 15:42
-
did you use both animations? in and out? – pskink Sep 15 '18 at 15:46
-
yes. can the reason be that ImageSwitcher is not creating 2 ImageViews? – Usman Rana Sep 15 '18 at 15:49
-
you have to create them – pskink Sep 15 '18 at 15:52
-
I've set Factory and I've that it is called 'makeView' twice but still transition happens for 1 view. – Usman Rana Sep 15 '18 at 15:57
-
no, if you use both animations then both `ImageView`s are animated – pskink Sep 15 '18 at 16:20
-
Used both animations, here is the code: https://stackoverflow.com/questions/52346477/imageswitcher-is-not-showing-outanimation – Usman Rana Sep 15 '18 at 16:24
-
Please see the given link it has code of animation as well – Usman Rana Sep 15 '18 at 16:27
-
https://codeshare.io/arrywv – pskink Sep 15 '18 at 16:30
-
unfortunately result is still the same :/ – Usman Rana Sep 15 '18 at 16:35
-
I just changed resource on click and it worked fine even with my code., but when i set resource in onResouceReady method of Glide, it causes issue again. I'm updating image url each after 5 seconds that updates image with Glide using databinding. – Usman Rana Sep 15 '18 at 16:53
-
`setImageDrawable` should work too - i didnt test it though... – pskink Sep 15 '18 at 17:04
-
Thank you so much for your help :) . Issue was with ' .thumbnail(.1f)' of Glide request. – Usman Rana Sep 15 '18 at 17:10