Android Compose Migration
ASecurityUse `LazyColumn` for a vertically scrolling `RecyclerView` with `LinearLayoutManager`, and `LazyRow` for a horizontal one. Items are composed lazily instead of creating one large static layout. ```kotlin @Composable fun MessageList( messages: List<Message>, onMessageClick: (Message) -> Unit, ) { val listState = rememberLazyListState() LazyColumn( state = listState, modifier = Modifier.fillMaxSize(), contentPadding = PaddingValues(vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(8....
- 584 stars
- 0 votes
- 0 copies
- 9 views
- Added September 5, 2026
Works with
Security analysis
100/100Pro scans all 13 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill android-compose-migration --agent claude-codeAre you the author of Android Compose Migration?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-android-compose-migration-17b635e8)# Compose equivalent of `RecyclerView` with `LinearLayoutManager`
Use `LazyColumn` for a vertically scrolling `RecyclerView` with `LinearLayoutManager`, and `LazyRow` for a horizontal one. Items are composed lazily instead of creating one large static layout.
```kotlin
@Composable
fun MessageList(
messages: List<Message>,
onMessageClick: (Message) -> Unit,
) {
val listState = rememberLazyListState()
LazyColumn(
state = listState,
modifier = Modifier.fillMaxSize(),
contentPadding = PaddingValues(vertical = 8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
items(
items = messages,
key = { message -> message.id },
) { message ->
MessageRow(
message = message,
onClick = { onMessageClick(message) },
)
}
}
}
```
The mapping is:
- vertical `LinearLayoutManager` → `LazyColumn`
- horizontal `LinearLayoutManager` → `LazyRow`
- `ViewHolder` row → an item Composable
- adapter data updates → state-driven list updates
- stable item identity → `key`
- `RecyclerView` padding/gaps → `contentPadding`/`Arrangement.spacedBy`
Add headers or other fixed content with `item { ... }`. If the adapter contains a legacy/custom View that cannot yet be migrated, wrap that View with `AndroidView`; do not recreate it in the `update` block. Add a `@Preview`, compare with the existing XML screen, and run `./gradlew build` after integration.
Files in this skill
- eval-1.baseline.md
- eval-1.with-skill.md
- eval-2.baseline.md
- eval-2.with-skill.md
- eval-3.baseline.md
- eval-3.with-skill.md
- trigger-1.md
- trigger-2.md
- trigger-3.md
- trigger-4.md
- trigger-5.md
- trigger-6.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.