All android elements are placed at (0,0) in ConstraintLayout

Views: 66 Ask New Question


On By

1 Answer


If you are using ConstraintLayout you should be seeing warnings already on your elements.
Following is the warning Android Studio gives you.

This view is not constrained vertically: at run-time it will jump to the left unless you add a vertical constraint less... (⌘F1) 

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_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.

So basically you should make sure a widget has both horizontal and vertical constraints by dragging from the edge connections

On By


Answer This Question