Open booker0108 opened 10 years ago
Temporary fix for those want simple order from left to right
As the SGV always try to find the shortest column to put the next child, I modified the code to make its ordering in simple left to right order
private int getChildColumn(final int position, final boolean flowDown) { if(position < mColumnCount) return position; else return position%mColumnCount; }
My views have the same height but i have the same issue. Unfortunately, in my case, the workaround is ordering it from right to left. The left-most view of the last row is empty if the last row isn't completely filled with childrens.
@Bapho I am fine with my fix. I just wonder why you don't use official gridview if your views have same dimension?
@booker0108 I used different dimensions before. Plus headers, footers and variable column counts for landscape and portrait mode.
@Bapho
If you want a right to left order, please try below code(I haven't tried it)
private int getChildColumn(final int position, final boolean flowDown) { int newPosition = position%mColumnCount;
return mColumnCount-newPosition; }
I wanted a left-to-right order but your code isnt working if using headers. So i used this code:
private int getChildColumn( final int position, final boolean flowDown ) {
return ( position - getHeaderViewsCount() ) % mColumnCount;
Hi, I am developing an application that using the staggered grid view.
I have to load 4 different size images from server to form a bottom-level grid view which I designed and order the data to do so.
The correct order should be like below:
However, the view is now randomly place the 3rd image each time(sometime on left and sometime on right), and thus it makes the grid view finally in irregular shape.
How can I prevent this issue?