I’m having an issue with LazyColumn not showing th...
# compose
b
I’m having an issue with LazyColumn not showing the last item in a list when it’s in
androidx.compose.ui.platform.ComposeView
XML file.
Copy code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="<http://schemas.android.com/apk/res/android>"
    android:id="@+id/user_list_fragment_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:orientation="vertical">

    <androidx.compose.ui.platform.ComposeView
        android:id="@+id/composeView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</RelativeLayout>
// Composable
Column(
    modifier = Modifier
        .fillMaxWidth()
        .fillMaxHeight()
        .background(Color.White)
) {
    Row(
        modifier = Modifier.fillMaxWidth()
    ) {
        ...
    }
    LazyColumn(
        modifier = Modifier.fillMaxWidth(),
        state = listState
    ) {
        ...
    }
}
If I set the height to a manual number, the last item shows. It’s like the Lazy column is being drawn off screen. This is in a ViewPager fwiw
🧵 1
This seems to get the scrolling to work the way I want but it sucks to have to do this:
Copy code
LazyColumn(
                        modifier = Modifier
                            .fillMaxWidth()
                            .weight(1f),
                        state = listState
                    ) {
                        itemsIndexed(
                            shapes.filter {
                                "${it.id}".contains(searchQuery) ||
                                        it.name.contains(searchQuery) ||
                                        searchQuery.isEmpty()
                            }.sortedBy { it.id }
                        ) { index, shape ->
                            Log.d("TAG", "Index: $index ${shape.id}")
                            ShapesListItemUi(shape, awarenessViewModel)
                            if (index != shapes.size - 1) {
                                Divider(modifier = Modifier.fillMaxWidth(), color = Color.Black)
                            }
                        }
                        item {
                            Spacer(modifier = Modifier.size(64.dp))
                        }
                    }