LazyColumn versus Coluna Rolável
Entenda por que listas preguiçosas escalam melhor.
LazyColumn versus Coluna Rolável é uma aula grátis de Jetpack Compose Academy no CoddyKit. Esta é a aula 1 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Jetpack Compose Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Jetpack Compose Academy inclui 4 aulas no total.
Partes desta aula ainda não foram traduzidas e aparecem em inglês.
The Long-List Problem
When a list has hundreds of rows, you can't draw them all at once. You need a list that only builds what's actually visible on screen.
A Plain Column Builds Everything
A regular Column composes every single child immediately, even rows far below the screen. With long data, that wastes memory and time.
Column {
items.forEach { Text(it) }
}Column Needs verticalScroll
A plain Column doesn't even scroll on its own. You must add a verticalScroll modifier just to move past the screen edge.
Column(Modifier.verticalScroll(rememberScrollState())) {
items.forEach { Text(it) }
}Meet LazyColumn
A LazyColumn is the scrollable list built for big data. It composes rows on demand as you scroll, so the cost stays small. 🚀
LazyColumn {
// items go here
}Lazy Means On Demand
"Lazy" means a row is only created when it scrolls into view. Off-screen items simply don't exist yet, which keeps things fast and light.
Reuse, Not Rebuild
As rows leave the top, LazyColumn recycles them for new rows entering the bottom. A few dozen rows can serve thousands of items.
The items Block
Inside LazyColumn you describe content with an items block instead of a normal loop. Compose decides which ones to actually build.
LazyColumn {
items(names) { name ->
Text(name)
}
}Scrolling Is Built In
LazyColumn scrolls by default, so you never wrap it in verticalScroll. Adding one would actually cause a crash.
When a Column Is Fine
For a few fixed rows that all fit on screen, a plain Column is simpler and perfect. Reach for LazyColumn only when the list can grow.
Never Nest the Same Direction
Avoid putting a LazyColumn inside a vertically scrolling Column. The two scroll directions clash, and Compose can't measure the height.
Performance Is the Payoff
The big win is performance: smooth scrolling and steady memory no matter how long the data gets. That's why lazy lists scale.
Quick Check
Time to test which list to reach for.
Recap: Lazy Wins for Big Lists
A Column builds everything up front and needs verticalScroll; a LazyColumn builds rows on demand, recycles them, and scales effortlessly. 🎉
Perguntas Frequentes
A aula “LazyColumn versus Coluna Rolável” é grátis?
Sim — o texto completo de “LazyColumn versus Coluna Rolável” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Jetpack Compose Academy, atualize para CoddyKit PRO. O curso de Jetpack Compose Academy inclui 4 aulas no total.
O que vou aprender em “LazyColumn versus Coluna Rolável”?
Entenda por que listas preguiçosas escalam melhor. Você pratica Jetpack Compose Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.
Preciso ter experiência prévia para começar Jetpack Compose Academy?
Nenhuma experiência prévia é necessária. Jetpack Compose Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 1 de 4.
Quanto tempo leva a aula “LazyColumn versus Coluna Rolável”?
A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.
Posso escrever e executar código nesta aula de Jetpack Compose Academy?
Sim. Cada aula de Jetpack Compose Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.
Todas as aulas deste curso
- LazyColumn versus Coluna Rolável
- items e itemsIndexed
- Chaves para Listas Estáveis e Rápidas
- Cabeçalhos Fixos e Listas por Seção