Android 布局编辑器ConstraintLayout
Android Layout editor ConstraintLayout
我是 运行 Android Studio(前几天进行了最新的 stabel 升级。当我使用 Layout 编辑器时,它似乎更喜欢 ConstraintLayout。当我移动两个小部件(一个 TextView 和一个它周围的按钮)在编辑器上看起来没问题,但是当我在模拟器设备(Nexus 4)中尝试使用它时,它们最终都出现在右上角。在我的真实设备上也是如此。这里有版本问题吗?
请在此处检查 ConstraintLayout:
https://developer.android.com/training/constraint-layout/index.html
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).
换句话说,你必须为视图添加至少一个水平约束和一个垂直约束
我是 运行 Android Studio(前几天进行了最新的 stabel 升级。当我使用 Layout 编辑器时,它似乎更喜欢 ConstraintLayout。当我移动两个小部件(一个 TextView 和一个它周围的按钮)在编辑器上看起来没问题,但是当我在模拟器设备(Nexus 4)中尝试使用它时,它们最终都出现在右上角。在我的真实设备上也是如此。这里有版本问题吗?
请在此处检查 ConstraintLayout:
https://developer.android.com/training/constraint-layout/index.html
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).
换句话说,你必须为视图添加至少一个水平约束和一个垂直约束