The activity I am talking about must show a RecyclerView populated by CardViews as items. My goal is to show in every CardView a RecyclerView in its turn.<
As of support library 23.2, the LayoutManager API brings auto-measurement which allows a RecyclerView to size itself based on the size of its contents. This means that using WRAP_CONTENT for a dimension of the RecyclerView, are now possible. You’ll find all built in LayoutManagers now support auto-measurement.
Source
I faced the exact same problem. You have to specify the layout height of the RecyclerView inside the CardView. Change it from wrap_content to a specific value in dp. Nested RecyclerView doesnt wrap the content in its height if the parent scrolling is VERTICAL and similarly doesnt wrap the content in its width when the parent scrolling is HORIZONTAL.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_analysis"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:padding="5dp"
card_view:cardCornerRadius="5dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<android.support.v7.widget.RecyclerView
android:id="@+id/item_mode"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:paddingTop="5dp"
android:paddingLeft="@dimen/activity_horizontal_margin" >
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</android.support.v7.widget.CardView>