{"action":"created","issue":{"url":"https://api.github.com/repos/bumptech/glide/issues/681","labels_url":"https://api.github.com/repos/bumptech/glide/issues/681/labels{/name}","comments_url":"https://api.github.com/repos/bumptech/glide/issues/681/comments","events_url":"https://api.github.com/repos/bumptech/glide/issues/681/events","html_url":"https://github.com/bumptech/glide/issues/681","id":111036248,"number":681,"title":"Trying to load GIF image shows flashing colors in ImageView","user":{"login":"sumbulAlvi","id":14984167,"avatar_url":"https://avatars.githubusercontent.com/u/14984167?v=3","gravatar_id":"","url":"https://api.github.com/users/sumbulAlvi","html_url":"https://github.com/sumbulAlvi","followers_url":"https://api.github.com/users/sumbulAlvi/followers","following_url":"https://api.github.com/users/sumbulAlvi/following{/other_user}","gists_url":"https://api.github.com/users/sumbulAlvi/gists{/gist_id}","starred_url":"https://api.github.com/users/sumbulAlvi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sumbulAlvi/subscriptions","organizations_url":"https://api.github.com/users/sumbulAlvi/orgs","repos_url":"https://api.github.com/users/sumbulAlvi/repos","events_url":"https://api.github.com/users/sumbulAlvi/events{/privacy}","received_events_url":"https://api.github.com/users/sumbulAlvi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-12T19:09:01Z","updated_at":"2015-10-12T19:25:19Z","closed_at":null,"body":"Hi there! In the `bind()` method of my `recyclerView` I'm making the following call:\r\n```\r\nGlide.with(getContext())\r\n\t.load(url)\r\n\t.diskCacheStrategy(DiskCacheStrategy.SOURCE)\r\n\t.placeholder(R.color.white)\r\n\t.into(imageView);\r\n```\r\nDue to the custom logic, we require the `bind()` method to be called twice per cell. In the first call of bind, the imageView has not yet been measured correctly and the width/height is 0. For GIFs particularly, this seems to cause problems. Flashing colors appear in the place of where the gif should be. On recycling the view, the gif appears as expected. The colors seem to be the main colors that are in the bitmap of the GIF.\r\n\r\nWhen I put the condition `if (imageView.height > 0 && imageView.width > 0)` around the Glide command, the GIFs appear as expected. What is the reason that this is the case? \r\n\r\nHere is a GIF of the behavior I'm seeing:\r\n![incorrect-glide-behavior](https://cloud.githubusercontent.com/assets/14984167/10436211/03fb4606-70f3-11e5-9d94-4f4e3183adca.gif)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/bumptech/glide/issues/comments/147496944","html_url":"https://github.com/bumptech/glide/issues/681#issuecomment-147496944","issue_url":"https://api.github.com/repos/bumptech/glide/issues/681","id":147496944,"user":{"login":"TWiStErRob","id":2906988,"avatar_url":"https://avatars.githubusercontent.com/u/2906988?v=3","gravatar_id":"","url":"https://api.github.com/users/TWiStErRob","html_url":"https://github.com/TWiStErRob","followers_url":"https://api.github.com/users/TWiStErRob/followers","following_url":"https://api.github.com/users/TWiStErRob/following{/other_user}","gists_url":"https://api.github.com/users/TWiStErRob/gists{/gist_id}","starred_url":"https://api.github.com/users/TWiStErRob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TWiStErRob/subscriptions","organizations_url":"https://api.github.com/users/TWiStErRob/orgs","repos_url":"https://api.github.com/users/TWiStErRob/repos","events_url":"https://api.github.com/users/TWiStErRob/events{/privacy}","received_events_url":"https://api.github.com/users/TWiStErRob/received_events","type":"User","site_admin":false},"created_at":"2015-10-12T19:25:19Z","updated_at":"2015-10-12T19:25:19Z","body":"The colors actually make sense, they look like the dominant colors from each frame, for example: the queen's robe, Merida's skin, the throne. It looks like Glide somehow figures it needs to resize to 1x1 Bitmaps.\r\n\r\nAdd a `.listener()` to see what's the actual size of the Drawables are. Glide is OK with `getWidth() == 0` as long as the layout has a proper value which means \"it'll be known later\", which are `match_parent` or `wrap_content`; then it'll wait for the first measure-layout-draw and get the size after. In case you have `0dp` in XML, I'm afraid that condition is the best way. Also do you use a custom ImageView?"}}