StaggeredGridView
StaggeredGridView copied to clipboard
A column could offset some distance down when screen orientation changes
To repeat:
Scroll to list bottom and then change the screen orientation, if the current orientation is portrait, you will see a large blank on the bottom and when you scroll to list top and you will see one column offsets some distance. Else if the current orientation is landscape, just scroll to list top directly, you will see the same phenomenon.
Even though there is no imageview but only layout, this phenomenon is occured. I think this problem is related with Staggeredgridview library. But it is hard to pick what exactly problem is.
Thank you will take a look
If the size of the data collection up to 80 or more ,scroll to the bottom then back to the top,column will offset some distance
Hello there,
I'm experiencing a similar problem. Layouting ImageViews inside the StaggeredGridView (about 100) and scrolling up and down causes the columns (currently two) to shift against each other. This effect gets visible when scrolling back to the upside. One of both columns won't start at the top most point.
I will dive into this and see if a can find something.
Greetings.
@maurycyw any news on this possibly?
I have spottet the problem in my case (don't know if it is the same with you): Since StaggeredGridView aligns all views inside a column with their respective margin it is important to keep the height of all views inside this columns stay the same while scrolling. In my case I used ImageViews which have some loading problems. Sometimes the image views are not displayed when scrolling from the top to the bottom. Sometimes the same ImageView is displayed when scrolling back. This causes all the other views above this image view to get pushed up (because the only thing that stays consistent is the margin between the views, not their size).
To fix this behaviour, I would have to ensure my ImageViews load proper, or the containing views (I have some LinearLayout) that are placed inside the StaggeredGridView keep the same height independent of their content.
So, it seems in my case this behaviour is reasonable. Probably it could something similar with your problems?
Greetings David
Hi David. Thanks for your answer. That is a similar case with me too... Problem is my images have dynamic sizes which I don't know before lazily loading them. So I need a better solution. Trying to figure one out...
@BenMoment, did you find a solution? I am facing the same issue and am trying to figure out a way but no luck so far. If you did find something that works would love to hear what you had to do to get things to work! Thanks!
@jarvisv I ended up rewriting a staggered grid view that is based on a ListView with multiple cell views (ViewCount is larger), that actually recycles the views pretty well. This project is still too experimental...
@BenMoment, thanks for the reply. I might end up doing the same too.
I am facing same problem... If any one find solution, please update here......
@BenMoment @jarvisv If you guys are lazy loading an image view, try measuring the view before setting the image. I use Jake Wharton's AspectRatioImageView with the dominant measurement being the width of the view. https://gist.github.com/JakeWharton/2856179
@briangriffey https://gist.github.com/JakeWharton/2856179 is that working?? bcz when i use this not affected and still problem create plz give me solution for this
Many issues are caused by caching in onMeasure(). This one seems to be the same problem.
Have a look at https://github.com/maurycyw/StaggeredGridView/issues/89