Created
November 30, 2018 17:43
-
-
Save basarik/8845466489f5e627d13c963122cd3326 to your computer and use it in GitHub Desktop.
recycleview two columns and if list size is one, show row as a one column, othervise two columns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//documents -> list of recycleview | |
val layoutManager = GridLayoutManager(activity, 2) | |
layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { | |
override fun getSpanSize(position: Int): Int { | |
return if (documents.size > 1) 1 else 2 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment