0

I want to create a ui that like below :

UICollectionView Sample

There are some view and layout for this behaviour on android.

GridView: Fixed column number. It is useless for upper case.

StaggeredGridLayoutManager: Constructor requires span count. It is useless for upper case.

GridLayoutManager: It don't need a fixed column count.

GridLayoutManager layoutManager = new GridLayoutManager(this, 6);

    layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            switch (position % 5) {
                case 0:
                case 1:
                    return 3;
                case 2:
                case 3:
                case 4:
                    return 2;
            }
            throw new IllegalStateException("internal error");
        }
    });

But I have to give a column number for each row. How can I do this task on android like ios?

us2956
  • 476
  • 12
  • 27
  • Android does not provide anything like you are looking for, perhaps there is a library somewhere but nothing native – tyczj Jun 11 '18 at 14:16

1 Answers1

0

try FlexboxLayout library from github.

librushi
  • 81
  • 2
  • 6