如何在GridLayoutManager中准备setSpanSizeLookup

问题描述

在网格布局管理器中,我需要每18、36、54,... 18 * Nth ...个网格,其布局的宽度为:父级匹配,高度为60dp,以实现分页加载栏的目的。

这是我的代码,

 GridLayoutManager mng_layout = new GridLayoutManager(this,4);//WHAT IS 4 ?//
            mng_layout.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
                @Override
                public int getSpanSize(int position) {
                    int mod = position % 6;   //WHAT IS 6 ?//
    
                    if (position == 0 || position == 1)
                        return 2;    //WHAT IS 2 ?//
                    else if (position < 6)
                        return 1;   //WHAT IS 1 ?//
                    else if (mod == 0 || mod == 1)
                        return 2;   //WHAT IS 2 ?//
                    else
                        return 1;   //WHAT IS 1 ?//
                }
            }); 

i need this type of layout

如果有时间请在代码中解释注释行

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)