Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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