Skip to content

Instantly share code, notes, and snippets.

@bigstark
Created June 6, 2020 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bigstark/dadc7a5b3871857e5cf5833b5f8ad253 to your computer and use it in GitHub Desktop.
Save bigstark/dadc7a5b3871857e5cf5833b5f8ad253 to your computer and use it in GitHub Desktop.
// 참고로 안돌려보고 여기에서 대충 만든거라 컴파일 에러날 확률이 매우 높습니다.
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
super.getItemOffsets(outRect, view, parent, state)
outRect.setEmpty()
val position = parent.getChildAdapterPosition(view).takeIf { it != RecyclerView.NO_POSITION } ?: run {
return
}
val space = 20.dp
outRect.left = space / 2
outRect.right = space / 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment