I'm trying to implement a horizontal recyclerview in a Navigation Drawer. It works fine aside from the fact that when I swipe to the left, the Navigation Drawer gets closed. Is there a way to prevent the Navigation Drawer from closing just when the user interacts with the recyclerview? I tried this way:
mNavigationRecyclerHourly.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
Log.d(TAG, "onTouch: ");
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
break;
case MotionEvent.ACTION_MOVE: mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
break;
case MotionEvent.ACTION_UP: mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
break;
}
return true;
}
});
Recyclerview xml:
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview_navigation_hourly"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/progress_navigation_uv"
android:scrollbars="horizontal"
android:overScrollMode="never"
android:scrollbarThumbHorizontal="@drawable/thumb_navigation"
android:layout_alignParentStart="true"
android:padding="8dp">
</android.support.v7.widget.RecyclerView>
Thanks for your help!