diff --git a/app/src/main/java/io/legado/app/ui/widget/RecyclerViewAtViewPager2.java b/app/src/main/java/io/legado/app/ui/widget/RecyclerViewAtViewPager2.java
new file mode 100644
index 000000000..f701b1a14
--- /dev/null
+++ b/app/src/main/java/io/legado/app/ui/widget/RecyclerViewAtViewPager2.java
@@ -0,0 +1,55 @@
+package io.legado.app.ui.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.RecyclerView;
+
+public class RecyclerViewAtViewPager2 extends RecyclerView {
+
+ public RecyclerViewAtViewPager2(@NonNull Context context) {
+ super(context);
+ }
+
+ public RecyclerViewAtViewPager2(@NonNull Context context, @Nullable AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public RecyclerViewAtViewPager2(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ private int startX, startY;
+
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ switch (ev.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ startX = (int) ev.getX();
+ startY = (int) ev.getY();
+ getParent().requestDisallowInterceptTouchEvent(true);
+ break;
+ case MotionEvent.ACTION_MOVE:
+ int endX = (int) ev.getX();
+ int endY = (int) ev.getY();
+ int disX = Math.abs(endX - startX);
+ int disY = Math.abs(endY - startY);
+ if (disX > disY) {
+ if (disX > 50) {
+ getParent().requestDisallowInterceptTouchEvent(false);
+ }
+ } else {
+ getParent().requestDisallowInterceptTouchEvent(true);
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_CANCEL:
+ getParent().requestDisallowInterceptTouchEvent(false);
+ break;
+ }
+ return super.dispatchTouchEvent(ev);
+ }
+}
diff --git a/app/src/main/res/layout/fragment_books.xml b/app/src/main/res/layout/fragment_books.xml
index 8da85f913..1e2fbe64b 100644
--- a/app/src/main/res/layout/fragment_books.xml
+++ b/app/src/main/res/layout/fragment_books.xml
@@ -9,7 +9,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
-
-
-
-