Hey I'm trying to figure out how focus is supposed...
# compose-android
s
Hey I'm trying to figure out how focus is supposed to work (building for AndroidTV). In this simple case I have 2 rows and I want to set it up so each row "remembers" which of its items was selected when the focus comes back to that row. The current behavior is that when either A or B is focused and you press Down and then Up, A will always be selected.
Copy code
@Composable fun TwoRows() {
    Column {
        Row {
            Card(onClick = { }) {
                Text("A")
            }
            Card(onClick = { }) {
                Text("B")
            }
        }
        Card(onClick = { }) {
            Text("C")
        }
    }
}
Ok, I see that it's a non trivial problem that was solved in the samples with a lot of custom code https://github.com/android/tv-samples/blob/main/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/FocusGroup.kt