You problem is in this code .
tools:layout_editor_absoluteX="200dp"
tools:layout_editor_absoluteY="250dp"
Tools can tell Android Studio which properties are ignored at run time and are valid only when designing layouts.
For example, we want the android:text
property to work only in the layout preview, so you can do like this tools:text="I am a text"
.
Just like tools:layout_editor_absoluteY="250dp"
in the code .
Try this in your code .
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/bass"
android:layout_width="150dp"
android:layout_height="250dp"
android:text="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/snare"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/snare"
android:layout_width="150dp"
android:layout_height="250dp"
android:text="2"
app:layout_constraintLeft_toRightOf="@id/bass"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/closedhihat"
android:layout_width="150dp"
android:layout_height="250dp"
android:text="3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/hitom" />
<Button
android:id="@+id/hitom"
android:layout_width="150dp"
android:layout_height="250dp"
android:text="4"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/closedhihat"
app:layout_constraintRight_toRightOf="parent" />
</android.support.constraint.ConstraintLayout>
OUTPUT

Note
ConstraintLayout attribute
- layout_constraintLeft_toLeftOf
- layout_constraintLeft_toRightOf
- layout_constraintRight_toLeftOf
- layout_constraintRight_toRightOf
- layout_constraintTop_toTopOf
- layout_constraintTop_toBottomOf
- layout_constraintBottom_toTopOf
- layout_constraintBottom_toBottomOf
- layout_constraintBaseline_toBaselineOf
- layout_constraintStart_toEndOf
- layout_constraintStart_toStartOf
- layout_constraintEnd_toStartOf
- layout_constraintEnd_toEndOf