0

I am trying to create dynamic view in my app. In my screen there is multiple rows will be generated dynamically. I want to create dynamic layout for that. Here with I attached the screen design. Please refer that.

Sample image

Here 1st row have one column and 2nd,3rd rows have 2 columns. Then again 4th column will be 1 row.. Like that I want to create dynamic design. Please let me any idea for this.

Vijay
  • 3,152
  • 3
  • 24
  • 33
  • 2
    you have to implement your own logic in the adapter to achieve this. – anddevmanu May 04 '17 at 06:51
  • I think answer you are looking for is in [link](http://stackoverflow.com/questions/29457712/how-to-set-different-columns-for-rows-in-android-gridview). Here in getSpanSize() method you get position of each view in adapter and depending on position of view you can assign column span. – patilmandar2007 May 04 '17 at 07:00
  • @patilmandar2007.. Yes.. I think so.. I will try this and let you know soon... – Vijay May 04 '17 at 07:18

1 Answers1

0

I think what you want achieve is StaggeredGridView. It supports multiple columns with varying row size which should help you achieve what you need.

Github Library (Deprecated now): https://github.com/etsy/AndroidStaggeredGrid.

Fortunately RecyclerView comes with new LayoutManager called as StaggeredGridView.

Refer https://developer.android.com/reference/android/support/v7/widget/StaggeredGridLayoutManager.html to get started

Akshay Chordiya
  • 4,761
  • 3
  • 40
  • 52