I need to place a slider (based on ViewPager) and a list of records field (RecyclerView). I got this markup for this:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true"> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <RecyclerView android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" android:scrollbars="vertical"/> <FrameLayout android:id="@+id/slider" android:layout_width="match_parent" android:layout_height="260dp" android:layout_gravity="top"> <android.support.v4.view.ViewPager android:id="@+id/slider_pager" android:layout_width="match_parent" android:layout_height="match_parent"/> <media.nevsky.apost.CirclePageIndicator android:id="@+id/slider_indicator" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingBottom="12dp" android:paddingLeft="22dp" android:paddingRight="22dp" android:layout_gravity="bottom|center_horizontal"/> </FrameLayout> </FrameLayout> </ScrollView> 

And it seems to work, but the problem is that scrolling events (RecyclerView.OnScrollListener) do not work for RecyclerView. And I have on it podgruzka new entries occur. Tried to use instead of ScrollView NestedScrollView but without success. Is it possible to force RecyclerView.OnScrollListener to work in such conditions?

Used libraries:

 compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.4.0' compile 'com.android.support:recyclerview-v7:23.4.0' 

    1 answer 1

    It is not necessary to enter RecyclerView as a child of ScrollView as it can scroll if necessary. It is better to revise the markup like this: ScrollView to remove, instead of FrameLayout, try RelativeLayout.

    • Yes, then the slider will stop scrolling and RecyclerView will be, but it's not what you need, everything has to scroll by a whole page - wpbloger