Hi I am try to create a page as below,
I have a drawer layout and in the home screen I want to display notifications as in the screen shot. I am trying to do it by CardView
but I didn't got any tutorial explaining how I can achieve this in CardView
. I got tutorials for Cardview
in the listView
but not for my requirement. Can anybody tell me how I can achieve this?. What all the possible options I have for this in android?
Search for RecyclerView in android, and Cardview. The below example is just a purpose to show how to create like the pic you added. To add n
numbers of CardView
read "How to use RecyclerView in android".
<HorizontalScrollView
android:layout_width="your_size"
android:layout_height="your_size"
android:id="@+id/horizontalScrollView"
android:layout_below="@+id/your_id"
android:scrollbars="none">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="2dp">
<android.support.v7.widget.CardView
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_marginStart="2dp"
android:padding="2dp"
android:id="@+id/cardThree"
android:layout_toEndOf="@+id/cardTwo"
android:background="@color/card_color">
//your view here like a Layout including textView.
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="250dp"
android:layout_height="match_parent"
android:padding="2dp"
android:id="@+id/cardOne"
android:background="@color/card_color">
<//your view here like a Layout including textView.
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_marginStart="2dp"
android:padding="2dp"
android:id="@+id/cardTwo"
android:layout_toEndOf="@+id/cardOne"
android:background="@color/card_color">
//your view here like a Layout including textView.
</android.support.v7.widget.CardView>
</RelativeLayout>
</HorizontalScrollView>