Skip to content

Instantly share code, notes, and snippets.

@OmarKRostom
Last active March 17, 2021 04:20
Show Gist options
  • Save OmarKRostom/0fac07b62a95a97760d17901e341ee08 to your computer and use it in GitHub Desktop.
Save OmarKRostom/0fac07b62a95a97760d17901e341ee08 to your computer and use it in GitHub Desktop.
Second step creating an arc layout manager
class ArcLayoutManager(
private val context: Context,
private var horizontalOffset: Int = 0
) : RecyclerView.LayoutManager() {
override fun generateDefaultLayoutParams(): RecyclerView.LayoutParams =
RecyclerView.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
override fun canScrollHorizontally(): Boolean = true
override fun scrollHorizontallyBy(
dx: Int,
recycler: RecyclerView.Recycler?,
state: RecyclerView.State?
): Int {
horizontalOffset += dx
return dx
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment