Miguel Vargas
12/14/2021, 12:00 AMremember
to save the AndroidView as follows but it’s still recreating the Views as I scroll up and down. Is there any way to make it more efficient?
@Composable
fun ViewInLazyColumn() {
LazyColumn {
items(100) { idx ->
val context = LocalContext.current
val view = remember { MyView(context, idx.toString()) }
AndroidView(factory = { view }) } } }
class MyView(context: Context, value: String) : TextView(context) {
init {
// View keeps getting recreated
println("init MyView $value")
text = value } }
Andrey Kulikov
12/14/2021, 12:42 AMMiguel Vargas
12/14/2021, 12:44 AMremember
save the ViewAndrey Kulikov
12/14/2021, 12:46 AMMiguel Vargas
12/14/2021, 12:47 AM