etsy/AndroidStaggeredGrid滚动问题

etsy/AndroidStaggeredGrid滚动问题,android,staggered-gridview,Android,Staggered Gridview,我正在使用etsy/AndroidStaggeredGrid进行交错网格视图。我面临着非常严重的问题,如果我在网格中有一个项目,并试图向下和向上滚动,我根本看不到列表项目。如果有人知道这个问题,你能提供帮助吗 谢谢StaggedGridView.class 只需尝试添加此getChildCount()>1条件: protected void offsetChildrenTopAndBottom(final int offset, final int column) { if (DBG)

我正在使用etsy/AndroidStaggeredGrid进行交错网格视图。我面临着非常严重的问题,如果我在网格中有一个项目,并试图向下和向上滚动,我根本看不到列表项目。如果有人知道这个问题,你能提供帮助吗


谢谢

StaggedGridView.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);
        }
    }
受保护的void offsetchildrentop和bottom(最终整数偏移,最终整数列){
if(DBG)Log.d(标记“offsetchildrentop和bottom:+offset+”列:“+column”);
如果(getChildCount()>1){
最终整数计数=getChildCount();
for(int i=0;i
请检查:感谢您的回复Haresh,您有什么解决方案吗?您好,如果您想解决此问题,我们目前只有一个解决方案,请检查OffsetChildrenTop和Bottom,并将getchildcount条件设置为>1,这样它就不会添加偏移量。很好,是的,它对我有效,非常感谢您的建议,我也张贴和平的哪里再次检查这个条件谢谢。