0

I try to design card like youtube kids as you can see in image below

Youtube kids

without using ConstraintLayout but I cant find any layout can do something like this

Mahmood Ali
  • 487
  • 1
  • 6
  • 19

2 Answers2

0

So you want to use recyclerview with vertically placed cards? Use linear layout. Otherwise you should really specify what your problem is.

Naman Jain
  • 321
  • 5
  • 21
  • The problem is : How to design item which appear like card stack – Mahmood Ali Jun 28 '19 at 13:38
  • oh. Why dont you create an xml that has that card stack as a background, and then in your code you can use that view as an adapter for each individual card? – Naman Jain Jun 30 '19 at 17:56
0

Do you want to show a view similar to stack? or do you want it to be functional like as of Tinder, with swipe actions, because in Youtube it is implemented as a view which can only be clicked but cannot be swiped.

Then go for coordinator layout. If you only want a static view.

For reference, you can check this

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_margin="10dp"
    android:layout_height="wrap_content">

    <androidx.cardview.widget.CardView
        android:id="@+id/image_1"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        app:layout_anchorGravity="bottom"
        android:layout_marginEnd="5dp"
        android:layout_marginBottom="5dp"
        android:layout_marginStart="15dp"
        android:layout_gravity="bottom" />

    <androidx.cardview.widget.CardView
        android:id="@+id/image_2"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        app:layout_anchor="@+id/image_1"
        app:layout_anchorGravity="bottom"
        android:layout_marginEnd="10dp"
        android:layout_marginBottom="10dp"
        android:layout_marginStart="10dp"
        android:layout_gravity="bottom" />

    <androidx.cardview.widget.CardView
        android:id="@+id/image_3"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:scaleType="centerCrop"
        app:layout_anchor="@+id/image_2"
        app:layout_anchorGravity="bottom"
        android:layout_marginEnd="15dp"
        android:layout_marginBottom="15dp"
        android:layout_marginStart="5dp"
        android:layout_gravity="bottom" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
Baljeet
  • 84
  • 3