This view is not constrained vertically: at runtime it will jump to the left unless you add a vertic

来源:互联网 发布:win7右下角网络感叹号 编辑:程序博客网 时间:2024/05/29 18:05

Android studio 使用约束布局(ConstraintLayout)报错:

This view is not constrained vertically: at runtime it will jump to the left unless you add a vertical constraint less… (Ctrl+F1)
The layout editor allows you to place widgets anywhere on the canvas, and it records the current position with designtime attributes (such as layout_editor_absoluteX.) These attributes are not applied at runtime, so if you push your layout on a device, the widgets may appear in a different location than shown in the editor. To fix this, make sure a widget has both horizontal and vertical constraints by dragging from the edge connections.
这里写图片描述

解决方案:
1.切换xml到design试图下
2.选中ConstraintLayout右键选择Constraint Layout中的Infer Constraints
这里写图片描述

阅读全文
2 0