为什么android工作室显示错误“约束布局中缺少约束”? [英] why android studio show error of "Missing constraints in constraintlayout"?

查看:6950
本文介绍了为什么android工作室显示错误“约束布局中缺少约束”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图片

此视图不受约束,它只有设计时间位置,因此除非添加约束,否则它将跳转到(0,0)

This view is not constrained, it only has design time positions, so it will jump to (0,0) unless you add constraints

布局编辑器允许您放置窗体上任意位置的窗口小部件,它使用设计时属性(例如layout_editor_absolute X)记录当前位置。这些属性在运行时不应用,因此如果在设备上推送布局,窗口小部件可能会出现在不同的位置比在编辑器中显示的。要解决此问题,请通过从边连接拖动来确保窗口小部件具有水平和垂直约束

The layout editor allows you to place widgets anywhere on the canvas, and it records the current position with design time attributes (such as layout_editor_absolute X.) These attributes are not applied at run time, 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

推荐答案

这很简单解决这个问题。只需单击小部件(例如按钮或文本框等),然后单击推断约束按钮。
您可以在附图或Youtube链接中看到: https://www.youtube .com / watch?v = uOur51u5Nk0

It is very simple to solve this problem. Just click on the widget (for example button or textbox, etc.) then click on the "Infer constraints" Button. You can see in the attached picture or this Youtube link: https://www.youtube.com/watch?v=uOur51u5Nk0

这篇关于为什么android工作室显示错误“约束布局中缺少约束”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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