-
-
Save virendersran01/0fc23185e84670387a8187725c7fa240 to your computer and use it in GitHub Desktop.
Third 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
private fun fill(recycler: RecyclerView.Recycler?, state: RecyclerView.State?) { | |
detachAndScrapAttachedViews(recycler ?: return) | |
for (itemIndex in 0 until itemCount) { | |
val view = recycler.getViewForPosition(itemIndex) | |
addView(view) | |
val viewWidth = pxFromDp(context, ITEM_WIDTH) | |
val viewHeight = pxFromDp(context, ITEM_HEIGHT) | |
measureChildWithMargins(view ?: return, viewWidth.toInt(), viewHeight.toInt()) | |
} | |
recycler.scrapList.toList().forEach { | |
recycler.recycleView(it.itemView) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment