Created
July 6, 2018 10:53
-
-
Save kumamotone/23d40d66b37e1e23cb8ad6a24f0a7542 to your computer and use it in GitHub Desktop.
GridLayoutManager で 最初の行だけ打ち抜きで表示する
This file contains hidden or 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
| recyclerView.also { recyclerView -> | |
| val columnsNum = 3 | |
| val layoutManager = GridLayoutManager(applicationContext, columnsNum) | |
| layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { | |
| override fun getSpanSize(position: Int): Int { | |
| return when (position) { | |
| 0 -> columnsNum | |
| else -> 1 | |
| } | |
| } | |
| } | |
| recyclerView.layoutManager = layoutManager | |
| recyclerView.adapter = HogeAdapter() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment