Last active
October 12, 2018 01:16
-
-
Save dyguests/7f7c3e3090be204b50e60d1d82abd69a to your computer and use it in GitHub Desktop.
RecyclerView custom divider.
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
headerView.rv_vote_option.addItemDecoration(object : RecyclerView.ItemDecoration() { | |
val space = 10.px | |
override fun getItemOffsets(outRect: Rect?, view: View?, parent: RecyclerView?, state: RecyclerView.State?) { | |
if (parent?.getChildAdapterPosition(view) ?: 0 != voteOptions.size - 1) { | |
outRect?.set(0, 0, 0, space) | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment