2

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

Amit Kumar
  • 219
  • 1
  • 3
  • 11

2 Answers2

3

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>
Akshay Rajput
  • 250
  • 4
  • 11
0

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

Alireza
  • 446
  • 4
  • 15