28 lines
740 B
Java
28 lines
740 B
Java
package com.sw.inbound.view;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.MotionEvent;
|
|
|
|
import androidx.annotation.Nullable;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
public class NonScrollRecyclerView extends RecyclerView {
|
|
|
|
public NonScrollRecyclerView(Context context) {
|
|
super(context);
|
|
}
|
|
|
|
public NonScrollRecyclerView(Context context, @Nullable AttributeSet attrs) {
|
|
super(context, attrs);
|
|
}
|
|
|
|
@Override
|
|
public boolean dispatchTouchEvent(MotionEvent ev) {
|
|
// 请求父View不拦截事件,确保子View能接收到事件
|
|
getParent().requestDisallowInterceptTouchEvent(true);
|
|
return super.dispatchTouchEvent(ev);
|
|
}
|
|
}
|
|
|