Constraintlayout's infer Constraints (inference constraint)

Source: Internet
Author: User

When using Constraintlayout, an exception was found:

This view isn't constrained Vertically:at runtime it'll jump to the left unless you add a vertical constraint less ... (CTRL+F1)
The layout editor allows widgets anywhere on the canvas, and it records the current position with Designtime attributes (such as Layout_editor_absolutex.) These attributes is not applied at runtime, so if you push your layout on a device, the widgets could appear in a different Location than shown in the editor. To fix this, make sure a widget have both horizontal and vertical constraints by dragging from the edge connections.

I carefully checked the constraints, there is no problem, but show me the lack of constraints, compiled will be all the control heap in the upper left corner, I chose to ignore the exception, but the exception did not ignore me, the compiled effect is similar to farmelayout did not add the same effect of location constraints, and then find Baidu, Found the solution:

1. Switch XML to design and try to
2. Select Constraintlayout Right-click to select Infer in constraint layout Constraints

But I opened the Androidstudio view and examined it carefully, but I didn't find the hint on the diagram above:

At last I examined it carefully and finally let me find:

Solve the problem. Reference:

http://blog.csdn.net/u010296640/article/details/72922165

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.