Skip to content

Instantly share code, notes, and snippets.

@alorma
Created May 15, 2018 09:19
Show Gist options
  • Save alorma/7eb1d2c29125a0afe0de140819aa3807 to your computer and use it in GitHub Desktop.
Save alorma/7eb1d2c29125a0afe0de140819aa3807 to your computer and use it in GitHub Desktop.
fun RecyclerView.divider(orientation: Int = DividerItemDecoration.VERTICAL,
@DrawableRes drawable : Int = R.drawable.list_divider) {
val itemDecoration = DividerItemDecoration(context, orientation).apply {
ContextCompat.getDrawable(context, drawable)?.let {
setDrawable(it)
}
}
addItemDecoration(itemDecoration)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment