title: Can't set RecyclerView inside CardView?
body: <p><a href="https://i.stack.imgur.com/RGJdd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RGJdd.jpg" alt="enter image description here" /></a></p>
  <p>I'm trying to put a <code>RecyclerView</code> inside a <code>CardView</code> and create items dynamically.</p>
  <p>Obviously, in <code>XML</code>, <code>RecyclerView</code> is set inside <code>CardView tag</code>, but as you can see picture, <code>RecyclerView</code> item is created outside <code>CardView</code>.</p>
  <p>(<code>RecyclerView's items</code> are the parts expressed as <code>kg</code> and <code>set</code> in the photo. And <code>CardView</code> is also an item of another <code>RecyclerView</code>.)</p>
  <p>What's the problem?</p>
  <p><em><strong>XML</strong></em></p>
  <pre><code>&lt;androidx.cardview.widget.CardView
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      app:layout_constraintTop_toTopOf=&quot;parent&quot;
      android:layout_marginTop=&quot;12dp&quot;
      android:layout_marginLeft=&quot;12dp&quot;
      android:layout_marginRight=&quot;12dp&quot;
      app:cardElevation=&quot;10dp&quot;&gt;
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;&gt;
          &lt;LinearLayout
              android:id=&quot;@+id/ll1&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:orientation=&quot;vertical&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot;&gt;
              &lt;TextView
                  android:id=&quot;@+id/workout&quot;
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_margin=&quot;8dp&quot;
                  android:text=&quot;TEST&quot;/&gt;
              &lt;View
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;2dp&quot;
                  android:background=&quot;@color/light_blue_400&quot;/&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id=&quot;@+id/ll2&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:orientation=&quot;horizontal&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/ll1&quot;&gt;
  
              &lt;com.google.android.material.button.MaterialButton
                  android:id=&quot;@+id/delete&quot;
                  android:layout_width=&quot;0dp&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_weight=&quot;1&quot;
                  android:layout_marginStart=&quot;8dp&quot;
                  android:layout_marginEnd=&quot;4dp&quot;
                  style=&quot;@style/RoutineButtonStyle&quot;
                  android:text=&quot;DELETE&quot;
                  app:icon=&quot;@drawable/ic_delete&quot;/&gt;
  
              &lt;com.google.android.material.button.MaterialButton
                  android:id=&quot;@+id/add&quot;
                  android:layout_width=&quot;0dp&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_weight=&quot;1&quot;
                  android:layout_marginStart=&quot;4dp&quot;
                  android:layout_marginEnd=&quot;8dp&quot;
                  style=&quot;@style/RoutineButtonStyle&quot;
                  android:text=&quot;ADD&quot;
                  app:icon=&quot;@drawable/ic_add&quot;/&gt;
          &lt;/LinearLayout&gt;
          &lt;androidx.recyclerview.widget.RecyclerView
              android:id=&quot;@+id/rv&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_margin=&quot;10dp&quot;
              app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
              app:layout_constraintRight_toRightOf=&quot;parent&quot;
              app:layout_constraintTop_toBottomOf=&quot;@id/ll2&quot;
              android:orientation=&quot;vertical&quot;
              app:layoutManager=&quot;androidx.recyclerview.widget.LinearLayoutManager&quot;/&gt;
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  &lt;/androidx.cardview.widget.CardView&gt;
  </code></pre>
  <p>Let me know if you need any other code.</p>