The trick here is to create a 'mother' RecyclerView that hosts other recycler views. Make you Items like this :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/your_content"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
Then make an appropriate ViewHolder :
public static class ViewHolder extends RecyclerView.ViewHolder {
private TextView textView;
private RecyclerView recyclerView;
public ViewHolder(View itemView) {
super(itemView);
textView = (TextView) itemView.findViewById(R.id.your_content);
recyclerView = (RecyclerView) itemView.findViewById(R.id.item_rv);
}
}
Now, setup the RecylerView when Binding :
public void onBindViewHolder(ViewHolder viewHolder, int i) {
viewHolder.textView.setText("This is content " + i);
viewHolder.recyclerView.setLayoutManager(new GridLayoutManager(activity, 2, LinearLayoutManager.HORIZONTAL, false));
viewHolder.recyclerView.setAdapter(new MyAdapter());
}