且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android 布局编辑器 ConstraintLayout

更新时间:2023-01-09 08:06:02

请在此处检查 ConstraintLayout:

Please check ConstraintLayout here:

https://developer.android.com/training/constraint-layout/index.html

当您将视图放入布局编辑器时,它会留在您离开的位置即使它没有任何限制.然而,这只是为了使编辑更容易;如果运行布局时视图没有约束在设备上,它被绘制在位置 [0,0](左上角).

When you drop a view into the Layout Editor, it stays where you leave it even if it has no constraints. However, this is only to make editing easier; if a view has no constraints when you run your layout on a device, it is drawn at position [0,0] (the top-left corner).

换句话说,这意味着您必须为视图添加至少一个水平和一个垂直约束

In other words, it means you must add at least one horizontal and one vertical constraint for the view