Java – this view is not constrained

I received the following error, I used 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" />

Solution

To quickly resolve this issue, use this very useful shortcut in Android Studio:

Right click widget in question > constraint layout > infer constraint:

After that, you can adjust the constraints as follows: https://stackoverflow.com/a/37960888/5556250

to update

This is incorrect for Android studio V3 and later According to @ purpleladydragons's comment:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>