I have a horizontal RecyclerView
inside a ScrollView
but none of the adapter methods are being triggered.
This is my fragment with the ScrollView
:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/selector"
android:layout_width="match_parent"
android:layout_height="100dp"
android:id="@+id/selector"/>
.....
.....
</RelativeLayout>
</ScrollView>
This is my selector.xml layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@color/green">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_kids"
android:layout_width="match_parent"
android:layout_height="100dp" />
</LinearLayout>
And here I'm setting the adapter to the RecyclerView
:
selectorAdapter = new selectorAdapter(activity, kids);
rv_items.setLayoutManager(new LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false));
rv_items.setAdapter(selectorAdapter);
selectorAdapter.notifyDataSetChanged();
The thing is, the green background I've set to the selector shows up but none of the adapter methods are triggered and the RecyclerView
doesn't inflate.
What can I do differently?