Shielded ScrollView sliding operations, such as the following, will use the Viewconfiguration class, this class can get to whether the user is a sliding operation of the critical value.
The code is as follows:
Package Com.xx.uikit.view;import Android.content.context;import Android.util.attributeset;import Android.view.motionevent;import Android.view.viewconfiguration;import android.widget.scrollview;/** * Copyright© Edaixi. All rights Reserved. * author:wei_spring * DATE:16/8/19 * Email: * Function: Custom ScrollView, block sliding events, resolve sliding conflicts with recycler */public class RECYCLERSCR Ollview extends ScrollView {private int downY; private int mtouchslop; Public Recyclerscrollview (Context context) {super (context); Mtouchslop = Viewconfiguration.get (context). Getscaledtouchslop (); } public Recyclerscrollview (context context, AttributeSet Attrs) {Super (context, attrs); Mtouchslop = Viewconfiguration.get (context). Getscaledtouchslop (); } public Recyclerscrollview (context context, AttributeSet attrs, int defstyleattr) {Super (context, Attrs, defst YLEATTR); Mtouchslop = Viewconfiguration.get (context). Getscaledtouchslop (); } @Override Public Boolean onintercepttouchevent (Motionevent e) {int action = e.getaction (); Switch (action) {Case MotionEvent.ACTION_DOWN:downY = (int) E.getrawy (); Break Case MotionEvent.ACTION_MOVE:int Movey = (int) E.getrawy (); if (Math.Abs (movey-downy) > Mtouchslop) {return true; }} return Super.onintercepttouchevent (e); }}
Android Shielded ScrollView Swipe operation