Change width and height of SimpleDraweeView
Hi, I how can i change the width and height of SimpleDraweeView according to the Image received from the URI.
See http://frescolib.org/docs/listening-download-events.html#_
In ControllerListener.onFinalImageSet you have ImageInfo.getWidth and ImageInfo.getHeight. You can then set a layout params to your view based on the image dimensions.
Although this is doable as suggested above, I wouldn't recommend doing it. Changing the size of the view when the image arrives is usually unpleasant to the user, and rarely desireable. Consider an user that is reading a story that contains a photo. It'd be very disruptive if the text suddenly jumps up or down as the image appears. That's probably true for pretty much any content. Could you give us more context on why do you need this? (I am still looking for a legit use case of this "feature".)
@plamenko thanks for the reply. I am developing an application where I have to show images of different height and width in a Listview. As I have no layout param info before downloading the image how can I achieve this using SimpleDraweeView. You are right about the user experience though. Can we add some translation animation while changing the SimpleDraweeView layout param.
I see. Yeah, if you could get the dimensions of the image along with its uri, that would be the best. As for animation, you can do whatever you want. ControllerListener will notify you when the image is loaded and it will provide the dimensions of the image. At that point you can start your custom animation or something.
@tuhin10 I have the same problem, do you have some good solutions now?