Skip to content

Instantly share code, notes, and snippets.

@dyguests
Last active October 12, 2018 01:16
Show Gist options
  • Save dyguests/7f7c3e3090be204b50e60d1d82abd69a to your computer and use it in GitHub Desktop.
Save dyguests/7f7c3e3090be204b50e60d1d82abd69a to your computer and use it in GitHub Desktop.
RecyclerView custom divider.
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