我使用etsy/AndroidStaggeredGrid作为staggeredGrid视图。如果我在网格中有一个项目,并尝试向上和向下滚动,我会遇到非常困难的问题,我根本看不到列表项。如果有人知道这个问题,你能提供任何帮助吗?
谢谢
发布于 2015-04-22 12:45:24
StaggeredGridView.class
只需尝试添加此getChildCount()>1条件:
protected void offsetChildrenTopAndBottom(final int offset, final int column) {
if (DBG) Log.d(TAG, "offsetChildrenTopAndBottom: " + offset + " column:" + column);
if(getChildCount()>1) {
final int count = getChildCount();
for (int i = 0; i < count; i++) {
final View v = getChildAt(i);
if (v != null &&
v.getLayoutParams() != null &&
v.getLayoutParams() instanceof GridLayoutParams) {
GridLayoutParams lp = (GridLayoutParams) v.getLayoutParams();
if (lp.column == column) {
v.offsetTopAndBottom(offset);
}
}
}
offsetColumnTopAndBottom(offset, column);
}
}https://stackoverflow.com/questions/29747031
复制相似问题