将match_parent转换为"0dp"; [英] converting match_parent to "0dp"

查看:110
本文介绍了将match_parent转换为"0dp";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在约束布局中使用android:layout_height="match_parent"android:layout_width="match_parent"作为子项的高度/宽度并构建Gradle文件时,它将自动分别更改为android:layout_height="0dp"android:layout_widtht="0dp".

When I use android:layout_height="match_parent" or android:layout_width="match_parent" as height/width of children in Constraint Layout and build the Gradle file it automatically changes to android:layout_height="0dp" or android:layout_widtht="0dp" respectively.

从技术上讲, 0dp match_parent 之间存在巨大差异.

Technically there is a huge difference between 0dp and match_parent.

大多数情况下,它不会影响我的布局,但有时这东西会完全破坏我的约束布局.

Most of the time it doesn't effect my layout but sometimes this thing completely destroy my Constraint Layout.

我不知道为什么会这样.
请引导我.

I don't know why this happens.
Please guide me.

推荐答案

match_parent.如果您想要相同的行为,请使用0dp并在父级的每一侧设置约束.

match_parent isn't supported in ConstraintLayout. If you want the same behavior, use 0dp and set constraints on each side to the parent.

这篇关于将match_parent转换为"0dp";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆