I want to align the lower views to the left edge of the top view
enter the image description here
but they go away like this:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
tools:context=".MainActivity">
<ImageButton
android:id="@+id/imageButton"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginStart="56dp"
android:layout_marginTop="24dp"
android:scaleType="centerCrop"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_code" />
<ImageButton
android:id="@+id/imageButton"
android:layout_width="120dp"
android:layout_height="120dp"
android:scaleType="centerCrop"
app:srcCompat="@drawable/ic_code"
tools:layout_editor_absoluteX="56dp"
tools:layout_editor_absoluteY="174dp" />
<ImageButton
android:id="@+id/imageButton"
android:layout_width="120dp"
android:layout_height="120dp"
android:scaleType="centerCrop"
app:srcCompat="@drawable/ic_code"
tools:layout_editor_absoluteX="56dp"
tools:layout_editor_absoluteY="333dp" />
<ImageButton
android:id="@+id/imageButton"
android:layout_width="120dp"
android:layout_height="120dp"
android:scaleType="centerCrop"
app:srcCompat="@drawable/ic_code"
tools:layout_editor_absoluteX="56dp"
tools:layout_editor_absoluteY="501dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
I have done it many times but it keeps doing this.
The constraint layout you posted is not accurate and correct. all the views are not constrained to each other Here is how we do it ->
Please contraint your child views as per your requirement , constraint layout gives a vast variety of constrainting options , i suggest you to refer to the documention of android : https://developer.android.com/develop/ui/views/layout/constraint-layout