-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image space occupied but not Image is shown #130
Comments
Hmm I'm not totally sure what the issue is. What is MyRequestListener? How does it relate to transformations? I can show a list containing the gif you provided a link for by replace simply replacing the load line in the giphy sample with this: Glide.with(activity)
.load("http://upload.wikimedia.org/wikipedia/commons/2/2b/Seven_segment_display-animated.gif")
.asGif()
.fitCenter()
.into(gifView); |
MyRequestListener is my custom class, implementing RequestListener<T, GlideDrawable>. public boolean onResourceReady(GlideDrawable resource, T model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
ImageView view = ((ImageViewTarget<?>) target).getView();
GifDrawable drawable = (GifDrawable) resource;
view.setBackgroundDrawable(drawable);
return false;
} Without this listener and with the below code, I am not able to see the image. Glide.with(activity)
.load("http://upload.wikimedia.org/wikipedia/commons/2/2b/Seven_segment_display-animated.gif")
.asGif()
.fitCenter()
.into(gifView); |
Can you show the xml or code for your image view? What are it's width and height? If it's easy for your to reproduce can you add a test case or a sample activity? It definitely shouldn't be necessary to set the drawable as the background drawable. Also if you change |
Created a test project https://github.com/harshavardhands/GlideTest If view.setImageDrawable() set then image is not shown to UI but when I used view.setBackgroundDrawable() i am able to view it. |
Hmm I'm still not able to reproduce the problem with your sample app. I wonder if this is version or device specific. What device/android os version are you using to test? My guess is that it's related to you using wrap_content to describe the width/height of your view. Glide wants to resize your images so wrap_content is hard for it to handle. It should still show the image, but you may want to consider switching to using a more concrete size (a warning is also logged about this). Screenshot from a nexus 7 2 on 4.4 below: |
Checked in Genymotion emulator: Virtual device Samsung galaxy S2-4.1.1 |
Have the same issue.
|
Sorry for the delay, I reproduced this and I'll have a fix up shortly. Thank you @harshavardhands for the sample project and following up with a specific version of Android, hugely helpful! Thanks @vladimir-belous as well for pinging the issue. Turns out it's a bug (or at least a difference in behavior) between Android 4.1 and 4.4. In 4.4 setVisible is always called on Drawables during ImageView#setImageDrawable, but not in 4.1. |
Thank you, very fast fix. |
I added a target milestone, but may do another dot release before then, in which case I'll update the issue. You can join the mailing list if you want to keep more careful track of releases and dates. For now you can always depend on the snapshot version which is built and pushed after each successful build on master:
|
In wiki (wiki/Transformations) given as "You can also apply either of the default transformations if you're loading Bitmaps or GIFs"
// For gifs:
Space is occupied, but image is not shown...
My Code:
By using listener it worked out.
The text was updated successfully, but these errors were encountered: