Rotate image in placeholder

10 views
Skip to first unread message

Hannah R

unread,
Mar 15, 2021, 11:49:38 AM3/15/21
to CodenameOne Discussions
Hi,

How can I implement something like infinite progress for EncodedImage placeholder? To my understanding, it should be something like icon.rotate180Degrees(true)?

I am putting Image into ImageViewer, 
Image originImg = URLImage.createToStorage(placeholder, photo_url, AppStrings.PICTURE_HANDLER+photo_url);

And my placeholder is 
EncodedImage placeholder = EncodedImage.createFromImage(Image.createImage(getWidth()/2, getWidth()/2 , 0xFFE6E6), true);

Instead of image with color 0xFFE6E6, I would like to put there rotating icon. I need it in order to show it when the actual Image is loading. How can I achieve this?

Thanks a lot!

Shai Almog

unread,
Mar 15, 2021, 10:44:26 PM3/15/21
to CodenameOne Discussions
Hi,
Animating a placeholder isn't supported and won't work since the image is statically added. We use the animation functionality to replace the placeholder later on so if you add an animation it might not work.

rotation will just rotate an image once which isn't what you want.
You can use InfiniteProgress and just replace it with an image Label when that finished downloading. But for that you would need to download the image manually. E.g. via ConnectionRequest.downloadImageToStorage etc.
Reply all
Reply to author
Forward
0 new messages