https://kotlinlang.org logo
#compose
Title
# compose
f

frank

04/06/2022, 4:37 PM
I'm doing the tutoríal of codelabs: Codelabs tuto. In the tests I have seen that the scroll only scrolls until "lazy Columns" and can't reach extra column. What am I doing wrong?
Copy code
Column() {
        Surface(
            color = MaterialTheme.colors.primary
        ) {
            Text(
                "Users:",
                Modifier.fillMaxWidth(),
                style = MaterialTheme.typography.h5.copy(fontWeight = FontWeight.ExtraBold),
                textAlign = TextAlign.Center
            )
        }

        Divider()

        LazyColumn( // List names
            modifier = Modifier.padding(vertical = 4.dp)
        ) {
            items(names) { name ->
                NamePickerItem(name)
            }
        }

        NamePickerName(name = "LuisEnrique2") // Extra item for compare
}
t

Tobias Gronbach

04/07/2022, 12:09 AM
What happens when you add .weight(1f) to the modifier of the LazyColumn (or a fixed height)? Does that change anything? To me it seems that LazyColumn just takes up all the space so that the bottom item is pushed out of screen.
f

frank

04/07/2022, 2:22 PM
What happens when you add .weight(1f) to the modifier of the LazyColumn (or a fixed height)? Does that change anything?
@Tobias Gronbach, The extra item will always be show but, I don't want this. (Attach img) I searched info. about scrolls and the columns don't add by default a Scroll. If I want a Scroll in my Column I need add this modifier
Modifier.verticalScroll(rememberScrollState())
but this throw conflict with lazyColumn. I fixed it by moving '*extra item*' inside the lazyColum. (I have to check if there is a better approach)
Copy code
LazyColumn( // List names
            modifier = Modifier
                .padding(vertical = 4.dp)
        ) {
            items(names) { name ->
                NamePickerItem(name)
            }

            item { // Extra item
                NamePickerName(name = "LuisEnrique2")
            }
}
5 Views