Learning Android Development
RecyclerView with Compose View is not Performant
Pick either RecyclerView or LazyColumn. Avoid mixing.
Published in
3 min readOct 11, 2021
As an experienced Android Developer, we know RecyclerView. But with Jetpack Compose, now we have LazyColumn.
RecyclerView and LazyColumnFor in Jetpack Compose
Learn The RecyclerView of Jetpack Compose
medium.com
But in the event, if we have an App that is actively being used, with lots of different ViewHolders
in it’s RecyclerView
, is it possible to add a Composable View as a ViewHolder
?
The answer is YES!
How to add Composable View in View Holder?
The guide is provided in Android Documentation. I’ll show you a simple design as below.
To design a ReyclerView, it’s easier to start from the ViewHolder first, then go backward, as advocated by this article.
1. Designing the ViewHolder with ComposeView
class ComposeItemViewHolder(
val composeView: ComposeView
) : RecyclerView.ViewHolder(composeView) {…