Created
November 1, 2019 14:13
-
-
Save mohamed-khaled-hsn/cc1abe362433be015efda82ff612f848 to your computer and use it in GitHub Desktop.
MarginItemDecoration
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
class MarginItemDecoration( | |
private val left: Int? = null, | |
private val top: Int? = null, | |
private val right: Int? = null, | |
private val bottom: Int? = null | |
) : RecyclerView.ItemDecoration() { | |
override fun getItemOffsets( | |
outRect: Rect, | |
view: View, | |
parent: RecyclerView, | |
state: RecyclerView.State | |
) { | |
left?.let { outRect.left = it } | |
top?.let { outRect.top = it } | |
right?.let { outRect.right = it } | |
bottom?.let { outRect.bottom = it } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment