AndroidStaggeredGrid
AndroidStaggeredGrid copied to clipboard
Quick Scroll in Landscape
When scrolling quickly in landscape, one can overshoot the bounds of the grid. Scrolling back up seems to do weird things to the column count. Works fine in portrait.
This video can probably offer more context: https://www.dropbox.com/s/qn6907yxwsv6wnj/device-2014-04-18-021943.mp4
To replicate, check out the U2020 repo (https://github.com/JakeWharton/u2020) and install the application, and scroll to the bottom in landscape. If you scroll fast enough, you can see it consistently, but occasionally even moderate speed scrolls can show this behaviour.
- U2020 is using an old version of the library, but I was able to reproduce the the same behaviour in the latest release
- I wasn't able to replicate the behavior in the repo's sample app even after playing around with the data set
- Explicitly setting the column count didn't help
- This is on a Nexus 7 (2013), was able to replicate on Nexus 5
Forgot the code..
<com.etsy.android.grid.StaggeredGridView
android:id="@+id/gallery_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="-1px"
android:listSelector="@android:color/transparent"
app:item_margin="8dp"
/>
Same problem here!!!
Got the same problem and hopefully this can be fixed. By far this is the best waterfall view I found for Android.
I got the same problem too!! It seems to appear when my device is in landscape mode, the ASG has 2 columns or more and I use the fling gesture to go to the bottom of the ASG.
Did some google, and I found a patch: https://github.com/venkat230278/AndroidStaggeredGridViewOverscrollBug/blob/master/patch/sg.patch As far as I've been trying, it seems that this patch solved this problem : )
Got the same problem
Is there any update on when this issue will be addressed?
the patch by @ktei seems to prevent the overscroll, but theres still some minor glitches
Question, how to apply the patch by @ktei if you are using gradle dependency?
I was trying to override it in a child class but the methods are private... The reason why I am asking is because I am access this StaggeredGridView via https://github.com/gabrielemariotti/cardslib so forking it is becoming quite difficult as I need to do it twice...
Also I am not sure if this is a landscape bug, I can create it quite easily in any mode when there is at least 2 columns. The bug happens when you have a row with one element in it, and therefore it think there is another column with data and therefore over scrolls.
Also, there is another temp fix... if you keep adding elements to the adaptor, but the problem is how many to add... usually an even amount works but not all the time.
@richardtan In worst case, I think you can just manually merge it... line by line... I'm wondering actually, is this project still being maintained? It seems this bug has been there for ages
@ktei - yeah thats what I just done as I was playing around yesterday... so I basically copied the class and renamed it, put it in the same package so that all the resources could still be used and change the code manually. Then all I did was used the newly created class (but I actually extended to it so if I need to go back to the original it is easy as changing that inherited class). Had to do it to three different classes from two different projects as I was using the AndroidStaggeredGrid indirectly from another library project... nightmare.
Not ideal, but it works, and the good thing is that I can turn on the debugging mode on (DGB boolean) and when you do it, you can see the problem, when you fling the BOTTOM and TOP goes to Integer.MAX_VALUE/Integer.MIN_VALUE so I now understand the bug :)
This solved my problem! Thank you so much guys, you saved a lot of time for me :)