ImageView size not refreshed when loading from cache
See original GitHub issueHello,
I have an imageView as the following
<ImageView android:id="@+id/logo" android:layout_width="match_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:layout_gravity="center_horizontal" />
When the image is loaded first time from the network the ImageView is rendred correctly and the height takes the height of the image. However when loading the Image the second time from the memory cache the imageView is not refreshed even if the image from the cache is there, the imageView height is not the same as the image.
Another scenario is if I set a placeholder, the second time the imageView keep the height the placeholder rather than the image loaded from the memory cache.
Any idea please ? I have already tried many workaround like invalidate the imageView on the callback but without success.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Ah! I see. Yeah, ViewTreeObservers are a good option if you want to check wether your layour has been drawn or not yet. 😃 Good to see it’s working now. 😃
I have changed the
addOnLayoutChangeListener
toimageView.getViewTreeObserver().addOnGlobalLayoutListener
and it is working fine now.Thanks for help.