-
-
Save virendersran01/9ba45066be91340f421625851e841a8d to your computer and use it in GitHub Desktop.
Second step creating an arc layout manager
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 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