CodexBloom - Programming Q&A Platform

implementing Gboard input lag in RecyclerView while using Jetpack Compose in Android 14

👀 Views: 36 đŸ’Ŧ Answers: 1 📅 Created: 2025-08-22
android jetpack-compose recyclerview kotlin

I'm trying to figure out I'm building a feature where I'm converting an old project and I'm experiencing important input lag when using Gboard in a RecyclerView that's implemented with Jetpack Compose on Android 14... The scenario seems to be most pronounced when typing in text fields that are part of the RecyclerView items. I noticed that the lag occurs intermittently, especially when the RecyclerView contains a larger dataset (e.g., over 100 items). I have already tried optimizing my Compose code by wrapping my items in `remember` and using `key` for the list items to improve performance, but the scenario continues. Here's a simplified version of my code: ```kotlin @Composable fun MyRecyclerView(items: List<MyItem>) { LazyColumn { items(items, key = { it.id }) { item -> MyItemView(item) } } } @Composable fun MyItemView(item: MyItem) { Column(modifier = Modifier.padding(8.dp)) { Text(text = item.title) TextField( value = item.input, onValueChange = { /* Update input */ }, modifier = Modifier.fillMaxWidth() ) } } ``` Furthermore, I enabled `setRecycledViewPool` on my RecyclerView to share view holders between different RecyclerViews that I am using, but the performance hasn't improved. Is there any known workaround or optimization strategies for dealing with input lag specifically involving Jetpack Compose and Gboard? Any help would be appreciated! For reference, this is a production REST API. Thanks for your help in advance! I'm developing on Ubuntu 20.04 with Kotlin. What are your experiences with this?