{"action":"created","issue":{"url":"https://api.github.com/repos/bumptech/glide/issues/388","repository_url":"https://api.github.com/repos/bumptech/glide","labels_url":"https://api.github.com/repos/bumptech/glide/issues/388/labels{/name}","comments_url":"https://api.github.com/repos/bumptech/glide/issues/388/comments","events_url":"https://api.github.com/repos/bumptech/glide/issues/388/events","html_url":"https://github.com/bumptech/glide/issues/388","id":65894232,"number":388,"title":"distorted image with dynamically sized image views","user":{"login":"martinflorek","id":1846589,"avatar_url":"https://avatars.githubusercontent.com/u/1846589?v=3","gravatar_id":"","url":"https://api.github.com/users/martinflorek","html_url":"https://github.com/martinflorek","followers_url":"https://api.github.com/users/martinflorek/followers","following_url":"https://api.github.com/users/martinflorek/following{/other_user}","gists_url":"https://api.github.com/users/martinflorek/gists{/gist_id}","starred_url":"https://api.github.com/users/martinflorek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinflorek/subscriptions","organizations_url":"https://api.github.com/users/martinflorek/orgs","repos_url":"https://api.github.com/users/martinflorek/repos","events_url":"https://api.github.com/users/martinflorek/events{/privacy}","received_events_url":"https://api.github.com/users/martinflorek/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bumptech/glide/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/bumptech/glide/labels/enhancement","name":"enhancement","color":"207de5"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2015-04-02T09:53:21Z","updated_at":"2016-07-13T11:41:07Z","closed_at":null,"body":"I have a list view (RecyclerView) with dynamically sized image views (just the height is changing). Every time before loading an image with Glide into an ImageView I set its aspect ratio (custom ImageView, where changing its aspect ratio calls \"requestLayout()\"). Due to list items recycling I often get a differently sized ImageView then its intended size and here the Glide loads a distorted image.\r\n\r\nProblem is that Glide decodes the image for the previous size of an ImageView e.g. 400x300 and then puts it in the final (newly layouted) ImageView with a different size e.g. 400x400. The layout/measuring of the ImageView happens after the Glide takes its size for image decoding even though a requestLayout() was called on the ImageView.\r\n\r\nI confirmed this with a RequestListener where in onResourceReady(...) method the GlideDrawable resource has the image view's old size e.g. 400x300 and the target ImageView has a new size here already e.g. 400x400.\r\n\r\nHow can I use Glide with dynamically sized image views? I tried layout(), invalidate() and other things instead of the requestLayout() but nothing worked. Or is this a bug in Glide?"},"comment":{"url":"https://api.github.com/repos/bumptech/glide/issues/comments/232330879","html_url":"https://github.com/bumptech/glide/issues/388#issuecomment-232330879","issue_url":"https://api.github.com/repos/bumptech/glide/issues/388","id":232330879,"user":{"login":"iqbalmuddassir","id":5850095,"avatar_url":"https://avatars.githubusercontent.com/u/5850095?v=3","gravatar_id":"","url":"https://api.github.com/users/iqbalmuddassir","html_url":"https://github.com/iqbalmuddassir","followers_url":"https://api.github.com/users/iqbalmuddassir/followers","following_url":"https://api.github.com/users/iqbalmuddassir/following{/other_user}","gists_url":"https://api.github.com/users/iqbalmuddassir/gists{/gist_id}","starred_url":"https://api.github.com/users/iqbalmuddassir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iqbalmuddassir/subscriptions","organizations_url":"https://api.github.com/users/iqbalmuddassir/orgs","repos_url":"https://api.github.com/users/iqbalmuddassir/repos","events_url":"https://api.github.com/users/iqbalmuddassir/events{/privacy}","received_events_url":"https://api.github.com/users/iqbalmuddassir/received_events","type":"User","site_admin":false},"created_at":"2016-07-13T11:41:06Z","updated_at":"2016-07-13T11:41:06Z","body":"I was facing the similar issue in list item, I solved it using override(width,height) while loading image into ImageView. You just need to know the width and height of the imageView before the request. I hope this would help others too. "}}
{"actor":{"display_login":"iqbalmuddassir"}}