etsy / AndroidStaggeredGrid

An Android staggered grid view which supports multiple columns with rows of varying sizes.
https://github.com/etsy/AndroidStaggeredGrid
4.76k stars 1.13k forks source link

How to set gird item height before loading image? #81

Closed RobotAmiee closed 10 years ago

RobotAmiee commented 10 years ago

I have image's width and height, how to set grid item(ImageView)'s width and height before loading image from server like Etsy? Maybe set them in Adapter's getView method?

RobotAmiee commented 10 years ago

Just set view width and height in getView and solved the problem.

RobotAmiee commented 10 years ago

That's not perfect, can you tell me how to make it just perfect like in Etsy?

denizmveli commented 10 years ago

Our API will tell us the width and height of an image before we load it from the server.

The steps are like this. 1 - Request a list of Etsy items along with their image url, width and height. For each item 2 - Set the image height ratio on the DynamicHeightImageView based on the image data. 3 - Request the image to be shown.

venki0552 commented 9 years ago

how to calculate the image height ratio with known height and width of the image? please explain. Thanks in advance