当我使用 android:layout_height="match_parent"
或 android:layout_width="match_parent"
作为约束布局中子项的高度/宽度并构建 Gradle 文件时分别自动更改为 android:layout_height="0dp"
或 android:layout_widtht="0dp"
。
从技术上讲,0dp 和 match_parent 之间存在巨大差异。
大多数时候它不会影响我的布局,但有时这个东西会完全破坏我的约束布局。
我不知道为什么会这样。
请指导我。
最佳答案
在 ConstraintLayout 中不支持 match_parent。如果您想要相同的行为,请使用 0dp 并将每一侧的约束设置为父级。
关于android - 将 match_parent 转换为 "0dp",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40126678/