Billy Newman
01/16/2024, 6:17 PMBilly Newman
01/16/2024, 6:23 PM<FrameLayout
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:behavior_hideable="true"
app:layout_insetEdge="bottom" app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior" >
<androidx.compose.ui.platform.ComposeView
android:id="@+id/bottom_sheet_compose"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</androidx.compose.ui.platform.ComposeView>
</FrameLayout>
In that fragment I show the bottom sheet with the compose view:
viewModel.showBottomSheet.observe(viewLifecycleOwner) {
binding.bottomSheetCompose.setContent {
MyContent()
}
}
Then in compose:
@Composable
private fun MyContent(
results: List<String>
) {
Surface(
Modifier._nestedScroll_(rememberNestedScrollInteropConnection())
) {
LazyColumn(Modifier._fillMaxSize_()) {
items(count = results.size) { index ->
…
}
}
}
}kaps
05/13/2024, 4:27 PM