androidstacktindercard

android image stack on top of each other horizontally


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


Solution

  • 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>