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
Asked
Active
Viewed 172 times
2 Answers
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
-
did not understand, is it possible to achieve in recycler view @Alireza – Amit Kumar Sep 26 '20 at 06:04
-
let me test on linearLayout – Alireza Sep 26 '20 at 06:15