This view is not constrained vertically: at runtime it will jump to the top unless you add a vertical constraint
If you get the above error in the activity XML file when trying to add an element in the UI say a Button or an EditText, well it's because you have not set the vertical or horizontal constraints. When you are on the design view you may also see the errors below,
❗️ Not Horizontally Contrained.
❗️ Not Horizontally Contrained.
- Go to your activity.xml file,
- Move to Design View,
- Under Pallette, select Layouts -> ConstraintLayout,
- Now click on the wand icon -> Infer Constraint.
- You should see layout_margin Top and Right added to the XML and error is gone.
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
tools:layout_editor_absoluteX="140dp"
tools:layout_editor_absoluteY="316dp" />
After:
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="140dp"
android:layout_marginTop="316dp"
android:text="Button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Check a visual GIF demo to make it easy to understand,

Solution This view is not constrained vertically
More Posts related to Android,
- Change Android Toast background color
- Maven : java.lang.ClassNotFoundException: Xmx512m
- This class should be public (android.support.v7.internal.widget.ActionBarView.HomeView) Lint Error
- Android Alert Dialog with Checkboxes example
- Android Error Generating Final Archive - Debug Certificate Expired
- How to add Newline to text in Android TextView
- Read Text file from SD Card : Android Programming
- [FIX] AndroidRuntime: FATAL EXCEPTION: main - java.lang.RuntimeException NullPointerException
- ActivityManager Warning: Activity not started, its current task has been brought to the front
- INSTALL_FAILED_INSUFFICIENT_STORAGE Android Error
- Android Developers Bluetooth Tutorial
- java.lang.ClassNotFoundException android.support.v7.widget.Toolbar [Fix]
- Android: Save Data in local Db using Android Room
- Channel 50 SMSes received every few minutes Android Phones
- 21 Useful Android Emulator Short-cut Keyboard Keys
- Changing Android Intent Tittle using java code
- Android : No Launcher activity found! Error
- How to change TextView or EditText Text Color on Focus and on Press
- How to display Toast on Button Click : Android
- Android : Execute some code after back button is pressed
- Stop android adb service from command prompt or terminal
- [Soluiton] You already have the latest version of Android Studio installed
- Create Custom Android AlertDialog
- Android R Cannot Be Resolved To A Variable
- How to make Android EditText not editable
More Posts:
- Android Activity Main xml stuck loading - Android-Studio
- How to create StackOverflow error in java - Java
- How to fix: You will need Google Chrome to install most apps, extensions and themes. - Chrome
- Sublime Text 3 Convert Case to Upper, Lower, Title or Swap - Sublime-Text
- Java -Day of the week using Java 8 DayOfWeek Enum - Java
- SharePoint list excel import error - Title is a required filed and can't be empty - SharePoint
- How to send SMS on Android Emulator - Android
- Users experience call quality issue, voice distortion, disconnection with Microsoft Teams call and meeting - Teams