我使用LazyColumn
inside BottomSheetDialogFragment
,但如果LazyColumn
向上滚动列表,则Bottom
工作表对话框滚动而不是LazyColumn
列表。似乎BottomSheetDialogFragment
拦截了用户触摸输入。
这就是它的外观:
LazyColumn
里面如何正确使用BottomSheetDialogFragment
?
MyBottomSheetDialogFragment.kt:
class MyBottomSheetDialogFragment : BottomSheetDialogFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return ComposeView(requireContext()).apply {
setContent {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text("Header", color = Color.Black)
LazyColumn(
Modifier
.weight(1f)
.fillMaxWidth()) {
items(100) {
Text("Item $it", Modifier.fillMaxWidth(), Color.Black)
}
}
}
}
}
}
}
并使用以下代码显示它:
MyBottomSheetDialogFragment().show(activity.supportFragmentManager, null)
当我们使用 XMLRecyclerView
列表时,为了解决这个问题,我们必须用这里描述的方法来包装列表,RecyclerView
但是如何使用 Jetpack Compose 来修复它?NestedScrollView