Create Beautiful Design Home Screen Using CardView android

A FrameLayout with a rounded corner background and shadow.
CardView uses elevation property on Lollipop for shadows and falls back to a custom emulated shadow implementation on older platforms.
CardView extends the FrameLayout and it is supported way back to Android 2.x.
In this article i am create layout design using CardView.

create activity_main.xml file

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#f2efef"
    tools:context=".MainActivity">


    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

            android:layout_marginLeft="15dp"
            android:layout_marginRight="15dp"
            android:layout_marginTop="30dp"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <TextView
                    android:id="@+id/textView9"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:padding="5dp"
                    android:text="Quotation Manager"
                    android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
                    android:textColor="@color/text_color" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:padding="5dp"
                android:layout_marginTop="10dp"
                android:weightSum="2">


                <android.support.v7.widget.CardView
                    android:id="@+id/cardview_add_quotation"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_margin="5dp"
                    android:layout_weight="1"
                    app:cardCornerRadius="15dp"
                    app:cardElevation="@dimen/card_shadow">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical">


                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="5dp"
                            android:padding="10dp">

                            <ImageView

                                android:layout_width="80dp"
                                android:layout_height="80dp"
                                android:layout_weight="1"
                                app:srcCompat="@drawable/ic_action_profile" />

                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="10dp"
                            android:background="@color/box_color"
                            android:padding="8dp">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:gravity="center"
                                android:text="Profile"
                                android:textColor="@color/text_color"
                                android:textSize="16sp" />
                        </LinearLayout>

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_margin="5dp"
                    android:layout_weight="1"
                    app:cardCornerRadius="15dp"
                    app:cardElevation="@dimen/card_shadow">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical">


                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="5dp"
                            android:padding="10dp">

                            <ImageView
                                android:id="@+id/imageView2"
                                android:layout_width="80dp"
                                android:layout_height="80dp"
                                android:layout_weight="1"
                                app:srcCompat="@drawable/ic_action_profile" />

                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="10dp"
                            android:background="@color/box_color"
                            android:padding="8dp">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:gravity="center"
                                android:text="Update Profile"
                                android:textColor="@color/text_color"
                                android:textSize="16sp" />
                        </LinearLayout>
                    </LinearLayout>

                </android.support.v7.widget.CardView>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:padding="5dp"
                android:weightSum="2">


                <android.support.v7.widget.CardView
                    android:id="@+id/cardview_add_client"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_margin="5dp"
                    android:layout_weight="1"
                    app:cardCornerRadius="15dp"
                    app:cardElevation="@dimen/card_shadow">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"

                        android:orientation="vertical">


                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="5dp"
                            android:padding="10dp">

                            <ImageView

                                android:layout_width="80dp"
                                android:layout_height="80dp"
                                android:layout_weight="1"
                                app:srcCompat="@drawable/ic_action_shop" />

                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="10dp"
                            android:background="@color/box_color"

                            android:padding="8dp">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:gravity="center"
                                android:text="Shop Now"
                                android:textColor="@color/text_color"
                                android:textSize="16sp" />
                        </LinearLayout>

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_margin="5dp"
                    android:layout_weight="1"
                    app:cardCornerRadius="15dp"
                    app:cardElevation="@dimen/card_shadow">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical">


                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="5dp"
                            android:padding="10dp">

                            <ImageView

                                android:layout_width="80dp"
                                android:layout_height="80dp"
                                android:layout_weight="1"
                                app:srcCompat="@drawable/ic_action_help" />

                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="10dp"
                            android:background="@color/box_color"
                            android:padding="8dp">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:gravity="center"
                                android:text="Help"
                                android:textColor="@color/text_color"
                                android:textSize="16sp" />
                        </LinearLayout>
                    </LinearLayout>

                </android.support.v7.widget.CardView>
            </LinearLayout>
        </LinearLayout>
    </ScrollView>
</RelativeLayout>

Preview 

Leave a Reply

Your email address will not be published. Required fields are marked *