首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >etsy/AndroidStaggeredGrid滚动问题

etsy/AndroidStaggeredGrid滚动问题
EN

Stack Overflow用户
提问于 2015-04-20 19:47:28
回答 1查看 359关注 0票数 2

我使用etsy/AndroidStaggeredGrid作为staggeredGrid视图。如果我在网格中有一个项目,并尝试向上和向下滚动,我会遇到非常困难的问题,我根本看不到列表项。如果有人知道这个问题,你能提供任何帮助吗?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2015-04-22 12:45:24

StaggeredGridView.class

只需尝试添加此getChildCount()>1条件:

代码语言:javascript
复制
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);
        }
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29747031

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档