android - 如何将 DialogFragment 放在另一个 DialogFragment 上方/下方?
问题描述
我正在尝试在 Dialog 片段上方/下方显示一些内容,但我不希望这两个位于相同的 XML 布局上,因为其中一个 DialogFragment 比另一个更宽,如果它们在同一个 XML 上,它看起来只是奇怪的。所以我试图实现这样的目标: 图片
我在这里发现了这个问题:如何将一个 DialogFragment 提升到另一个之上?但我认为这不适用于我的用例。
解决方案
这里不需要两个不同的对话框。只为一个对话框充气,里面有两张卡片。
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.google.android.material.card.MaterialCardView ... />
<com.google.android.material.card.MaterialCardView ... />
</androidx.constraintlayout.widget.ConstraintLayout>
推荐阅读
- java - tomcat9 关于堆内存的建议
- javascript - 限制搜索栏结果JS和HTML的数量
- mariadb - mariadb10.4 本地登录成功,但在远程机器上失败
- php - 我只想查看我在数据库中输入的最后一个数据,但它显示了 laravel-8 中数据库中的所有数据
- sql-server - 在执行过程中必须声明标量变量错误
- sql - 选择具有最大 ID 的整行
- javascript - 登录ASP.net会话密钥方法后无法获取数据
- php - PHP 日期格式显示不正确
- sql - SQL 查询用 4 个值的数组中的随机文本值更新列
- pom.xml - spstring boot pom.xml 有效的POM