android - 如何在用xml编写的标准底页对话框中使用jetpack compose的lazyColumn?
问题描述
我想通过以下代码在用xml编写的底部工作表对话框中添加lazyColumn:
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<FrameLayout
android:id="@+id/bottomSheet"
style="@style/FeedbackBottomSheetDialog"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.compose.ui.platform.ComposeView
android:id="@+id/search_engine_compose_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</androidx.core.widget.NestedScrollView>
</FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
在撰写视图中,lazyColumn 将被放置。问题是我不能将lazyColumn 与 NestedScrollView 一起使用,并出现以下错误和应用程序崩溃:
不允许在相同方向的布局中嵌套可滚动,例如 LazyColumn 和 Column(Modifier.verticalScroll())。 有没有人有任何想法如何解决这个问题。这是我的lazyColumn可组合
@Composable
fun MovieList(
movieName: List<String>
) {
LazyColumn {
items(movieName.size)
{
Text(movieName)
}
}
}
解决方案
在我的情况下,我有
<FrameLayout
isNestedScrollingEnabled = "true">
<ComposeView/>
</FrameLayout>
一切似乎都很好
推荐阅读
- serialization - 在 F# 中使用可区分联合反序列化数据的另一个失败
- python - 如何(在 Python 中)获取列中字符串的一部分并将其转换为列表?
- python - 获取 Python Django 'SERVER_PROTOCOL' TypeError:'NoneType' 对象不可下标
- email - 在 Pkg.add("SMTPClient") 之后构建 `LibCURL` 时出错 - 是否有解决方案或替代方案?
- javascript - 尝试在 Google Apps 脚本中获取文件的文件夹路径
- php - 尝试将日期插入数据库时如何修复“不正确的日期值:第 1 行的列‘StartDate’的‘2020’”
- eclipse - Eclipse/STS 使用的 Maven 在哪里,以便我可以从命令行运行它?
- javascript - 如何使用反应提取嵌套在api响应中的语言数据
- netlogo - 对列表的每个项目同时执行两个命令
- vue.js - 当我在 CREATED 挂钩中调用时,$route.name 和/或 $router.currentRoute.name 返回 null