I have a ViewPager
as a Item in my RecyclerView
.
Viewpager
scroll horizontally is working fine but when I am trying to scroll vertically my RecyclerView
by picking my ViewPager
which is item of RecyclerView
; my RecyclerView
is not scrolling.
mRecyclerViewCarouselInfo.setLayoutManager(new LinearLayoutManager(getContext(),LinearLayoutManager.VERTICAL,false));
mRecyclerViewCarouselInfo.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
int action = e.getAction();
switch (action) {
case MotionEvent.ACTION_MOVE:
rv.getParent().requestDisallowInterceptTouchEvent(true);
break;
}
return false;
}
@Override
public void onTouchEvent(RecyclerView rv, MotionEvent event) {
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
});
My layout code for Recyclerview is as below
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:orientation="vertical"
android:paddingBottom="@dimen/margin_gap_8">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:listSelector="@drawable/listitem_selector_bg"
android:visibility="visible"/>
</RelativeLayout>
try
mRecyclerViewCarouselInfo.setNestedScrollingEnabled(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With