title: How to add CardView to a Navigation Drawer Activity?
body: <p>I have been trying to add <code>CardView</code> to <code>navigationDrawer activity</code> and <code>collapsing toolbar layout</code> all in one activity so that I can view all my contents form navigation drawer and collapse the layout and use card view as my buttons to make it more attractive. but it works fine as long as I don't add card views into the layout, but when I add the <code>CardView</code> into the code that is <code>XML</code> file and run the program the emulator shows that the app has not responding.</p>
  
  <p>I need help with this, please anyone.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout 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:id="@+id/drawer"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="com.example.madhu.management.DashBoard"&gt;
  
  &lt;android.support.design.widget.CoordinatorLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#e0e0e0"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/appbar"
          android:layout_width="match_parent"
          android:layout_height="250dp"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
          &lt;android.support.design.widget.CollapsingToolbarLayout
              android:id="@+id/collapsingtoolbar"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@drawable/materialappbar"
              app:contentScrim="?attr/colorPrimary"
              app:expandedTitleMarginEnd="64dp"
              app:expandedTitleMarginStart="480dp"
              app:layout_scrollFlags="exitUntilCollapsed|scroll"
              app:title="management"&gt;
  
              &lt;android.support.v7.widget.Toolbar
                  android:id="@+id/toolbarid"
                  android:layout_width="match_parent"
                  android:layout_height="?attr/actionBarSize"
                  app:layout_collapseMode="pin"
                  app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /&gt;
          &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;android.support.v4.widget.NestedScrollView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;
  
          &lt;LinearLayout
              android:id="@+id/ll"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="#fcfcfc"
              android:gravity="center"
              android:orientation="vertical"
              android:padding="10dp"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:clipToPadding="false"
                  android:gravity="center"
                  android:orientation="horizontal"&gt;
  
                  &lt;android.support.v7.widget.CardView
                      android:id="@+id/bankcardId"
                      android:layout_width="160dp"
                      android:layout_height="190dp"
                      android:layout_margin="10dp"
                      android:clickable="true"
                      android:foreground="?android:attr/selectableItemBackground"&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:gravity="center"
                          android:orientation="vertical"&gt;
  
                          &lt;ImageView
                              android:layout_width="64dp"
                              android:layout_height="64dp"
                              android:background="@drawable/circlebackgroundpurple"
                              android:padding="10dp"
                              android:src="@drawable/ic_add_alert_white_24px" /&gt;
  
                          &lt;TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_marginTop="10dp"
                              android:text="Notice"
                              android:textStyle="bold" /&gt;
  
                          &lt;View
                              android:layout_width="match_parent"
                              android:layout_height="1dp"
                              android:layout_margin="10dp"
                              android:background="@color/lightgray" /&gt;
  
                          &lt;TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:gravity="center"
                              android:padding="5dp"
                              android:text="department notice board"
                              android:textColor="@android:color/darker_gray" /&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/android.support.v7.widget.CardView&gt;
  
                  &lt;android.support.v7.widget.CardView
                      android:layout_width="160dp"
                      android:layout_height="190dp"
                      android:layout_margin="10dp"
                      android:clickable="true"
                      android:foreground="?android:attr/selectableItemBackground"&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:gravity="center"
                          android:orientation="vertical"&gt;
  
                          &lt;ImageView
                              android:layout_width="64dp"
                              android:layout_height="64dp"
                              android:background="@drawable/circlebackgroundpink"
                              android:padding="10dp"
                              android:src="@drawable/ic_book_white_24px" /&gt;
  
                          &lt;TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_marginTop="10dp"
                              android:text="Notes"
                              android:textStyle="bold" /&gt;
  
                          &lt;View
                              android:layout_width="match_parent"
                              android:layout_height="1dp"
                              android:layout_margin="10dp"
                              android:background="@color/lightgray" /&gt;
  
                          &lt;TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:gravity="center"
                              android:padding="5dp"
                              android:text="Notes from faculty"
                              android:textColor="@android:color/darker_gray" /&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/android.support.v7.widget.CardView&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:clipToPadding="false"
                  android:gravity="center"
                  android:orientation="horizontal"&gt;
  
                  &lt;android.support.v7.widget.CardView
                      android:layout_width="160dp"
                      android:layout_height="190dp"
                      android:layout_margin="10dp"
                      android:clickable="true"
                      android:foreground="?android:attr/selectableItemBackground"&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:gravity="center"
                          android:orientation="vertical"&gt;
  
                          &lt;ImageView
                              android:layout_width="64dp"
                              android:layout_height="64dp"
                              android:background="@drawable/circlebackgroundgreen"
                              android:padding="10dp"
                              android:src="@drawable/ic_help_outline_white_24px" /&gt;
  
                          &lt;TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_marginTop="10dp"
                              android:text="Question papers"
                              android:textStyle="bold" /&gt;
  
                          &lt;View
                              android:layout_width="match_parent"
                              android:layout_height="1dp"
                              android:layout_margin="10dp"
                              android:background="@color/lightgray" /&gt;
  
                          &lt;TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:gravity="center"
                              android:padding="5dp"
                              android:text="Question banks and question papers"
                              android:textColor="@android:color/darker_gray" /&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/android.support.v7.widget.CardView&gt;
  
                  &lt;android.support.v7.widget.CardView
                      android:layout_width="160dp"
                      android:layout_height="190dp"
                      android:layout_margin="10dp"
                      android:clickable="true"
                      android:foreground="?android:attr/selectableItemBackground"&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:gravity="center"
                          android:orientation="vertical"&gt;
  
                          &lt;ImageView
                              android:layout_width="64dp"
                              android:layout_height="64dp"
                              android:background="@drawable/circlebackgroundyellow"
                              android:padding="10dp"
                              android:src="@drawable/ic_update_white_24px" /&gt;
  
                          &lt;TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_marginTop="10dp"
                              android:text="University Updates"
                              android:textStyle="bold" /&gt;
  
                          &lt;View
                              android:layout_width="match_parent"
                              android:layout_height="1dp"
                              android:layout_margin="10dp"
                              android:background="@color/lightgray" /&gt;
  
                          &lt;TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:gravity="center"
                              android:padding="5dp"
                              android:text="updates from university"
                              android:textColor="@android:color/darker_gray" /&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/android.support.v7.widget.CardView&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:clipToPadding="false"
                  android:gravity="center"
                  android:orientation="horizontal"&gt;
  
                  &lt;android.support.v7.widget.CardView
                      android:layout_width="340dp"
                      android:layout_height="150dp"
                      android:layout_margin="10dp"
                      android:clickable="true"
                      android:foreground="?android:attr/selectableItemBackground"&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:gravity="center"
                          android:orientation="vertical"&gt;
  
                          &lt;ImageView
                              android:layout_width="64dp"
                              android:layout_height="64dp"
                              android:background="@drawable/circlebackgroundpurple"
                              android:padding="10dp"
                              android:src="@drawable/ic_stars_white_24dp" /&gt;
  
                          &lt;TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_marginTop="10dp"
                              android:text="Results"
                              android:textStyle="bold" /&gt;
  
                          &lt;View
                              android:layout_width="match_parent"
                              android:layout_height="1dp"
                              android:layout_margin="10dp"
                              android:background="@color/lightgray" /&gt;
  
                          &lt;TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:gravity="center"
                              android:padding="5dp"
                              android:text="semister results"
                              android:textColor="@android:color/darker_gray" /&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/android.support.v7.widget.CardView&gt;
  
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
  
      &lt;/android.support.v4.widget.NestedScrollView&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  
  &lt;android.support.design.widget.NavigationView
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_gravity="start"
      android:background="#ffffff"
      app:headerLayout="@layout/header"
      app:itemIconTint="@color/colorPrimaryDark"
      app:itemTextColor="@color/colorPrimaryDark"
      app:menu="@menu/drawermenu" /&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>