You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a problem of "top margin".
The margin of column[0] was lower than column[1] for the first time.
I finally found what is the cause of the problem and I am sharing with you guys to prevent having the same problem.
On StaggeredGridView.java file,
//////////// I added two functions below.
private boolean getPositionIsHeaderFooter(final int position) {
GridItemRecord rec = mPositionData.get(position, null);
return rec != null ? rec.isHeaderFooter : false;
}
private void removePositionColumn(final int position) {
GridItemRecord rec = mPositionData.get(position, null);
if (rec != null) {
mPositionData.remove(position);
}
}
And then see if data is not matched to HeaderOrFooter.
@Override
protected void onChildCreated(final int position, final boolean flowDown) {
super.onChildCreated(position, flowDown);
if (!isHeaderOrFooter(position)) {
///////////// I added a if statement below.
// remove data which is unmatched to HeaderFooter or General one.
if(getPositionIsHeaderFooter(position)) {
removePositionColumn(position);
}
// do we already have a column for this position?
final int column = getChildColumn(position, flowDown);
The text was updated successfully, but these errors were encountered:
I had a problem of "top margin".
The margin of column[0] was lower than column[1] for the first time.
I finally found what is the cause of the problem and I am sharing with you guys to prevent having the same problem.
On StaggeredGridView.java file,
And then see if data is not matched to HeaderOrFooter.
The text was updated successfully, but these errors were encountered: