Commit 0f22f0b6 authored by jyx's avatar jyx

修复详情页列表滑动冲突

parent 5a9bc62f
...@@ -402,6 +402,7 @@ class UserProfileActivity : BaseActivity(), View.OnClickListener, UserProfileVie ...@@ -402,6 +402,7 @@ class UserProfileActivity : BaseActivity(), View.OnClickListener, UserProfileVie
layoutManager.orientation = LinearLayoutManager.HORIZONTAL layoutManager.orientation = LinearLayoutManager.HORIZONTAL
rcy_profile_album.layoutManager = layoutManager rcy_profile_album.layoutManager = layoutManager
rcy_profile_album.adapter = userProfileAlbumAdapter rcy_profile_album.adapter = userProfileAlbumAdapter
rcy_profile_album.isNestedScrollingEnabled = false
} }
override fun getMorePageFail() { override fun getMorePageFail() {
......
package com.duben.loveplayletd.ui.widgets;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import androidx.recyclerview.widget.RecyclerView;
public class CustomRecyclerView extends RecyclerView {
private float startY;
private static final int THRESHOLD = 10;
public CustomRecyclerView(Context context) {
super(context);
}
public CustomRecyclerView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomRecyclerView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
startY = ev.getY();
getParent().requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_MOVE:
float currentY = ev.getY();
float dy = currentY - startY;
if (dy < -THRESHOLD) {
getParent().requestDisallowInterceptTouchEvent(false);
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
getParent().requestDisallowInterceptTouchEvent(false);
break;
}
return super.dispatchTouchEvent(ev);
}
}
\ No newline at end of file
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
<com.duben.loveplayletd.ui.widgets.CustomRecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rcy_profile_album" android:id="@+id/rcy_profile_album"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="120dp" android:layout_height="120dp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment