android image stack on top of each other horizontally

206 views Asked by At

enter image description here

I want to display an image like this, like in stack on top of each other, How I can achieve this type of design dynamically

2

There are 2 answers

0
Akshay Rajput On BEST ANSWER

Please use this code:-

 <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <ImageView
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:contentDescription="@string/app_name"
            android:src="@drawable/image_1" />
        <ImageView
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:layout_marginStart="-50dp"
            android:contentDescription="@string/app_name"
            android:src="@drawable/image_2" />
    
        <ImageView
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:layout_marginStart="-50dp"
            android:contentDescription="@string/app_name"
            android:src="@drawable/image_3" />
        <ImageView
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:layout_marginStart="-50dp"
            android:contentDescription="@string/app_name"
            android:src="@drawable/image_4" />
    </LinearLayout>
2
Alireza On

set leftmargin to -16dp for example or 1/4 of width of your images