I get the following error and I am using Android studio 2.2 Preview 3. I searched Google but couldn't find any resources.
Error: This view is not constrained, it only has design time positions, so it will jump to (0,0) unless you add constraints
<TextView android:layout_width="384dp" android:layout_height="207dp" android:textAppearance="?android:attr/textAppearanceLarge" android:text="@string/calc_default_display" android:id="@+id/textView" android:background="#ffffff" android:layout_margin="0dp" android:gravity="bottom|end" android:textSize="70sp" android:nestedScrollingEnabled="false" android:maxLines="2" android:maxLength="17" tools:layout_editor_absoluteX="0dp" tools:layout_editor_absoluteY="0dp" />
To resolve this error, you need to add constraints to the Button view that fulfills the minimum requirement of the ConstraintLayout view. You can do this in two ways: Using the Infer Constraints option from the Design window's toolbar. Using the Constrain option from the View 's context menu.
To fix this, make sure a widget has both horizontal and vertical constraints by dragging from the edge connections.
To create a baseline constraint, right-click the text view you want to constrain and then click Show Baseline. Then click on the text baseline and drag the line to another baseline.
To quickly resolve this, use this very helpful shortcut in Android Studio:
Right-click widget-in-question > Constraint Layout > Infer Constraints:
Thereafter, you can tweak the constraints as described here: https://stackoverflow.com/a/37960888/5556250
Update
This is not correct for the Android Studio v3 and up. As per @purpleladydragons's comment:
"Constraint Layout" is not in the dropdown menu. Use the magic wand icon in the toolbar menu above the design preview; there is the "Infer Constraints" button.
Just click this and it will be solved
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With