解决SwipeRefreshLayout下拉刷新与SwipeMenuListView的冲突

来源:互联网 发布:pla 算法初始化 编辑:程序博客网 时间:2022/05/27 14:46

自定义控件SwipeRefreshLayout

package com.mingmen.view;import android.content.Context;import android.support.v4.widget.SwipeRefreshLayout;import android.util.AttributeSet;import android.view.MotionEvent;/** * Created by LiuYX on 2017/9/18. */public class MyRefushView extends SwipeRefreshLayout{    private int yDown;    private int yUp;    private int xDown;    private int xUp;    public MyRefushView(Context context, AttributeSet attrs) {        super(context, attrs);    }    @Override    public boolean onInterceptTouchEvent(MotionEvent ev) {        switch (ev.getAction()){            case MotionEvent.ACTION_DOWN:                xDown= (int) ev.getX();                yDown= (int) ev.getY();                break;            case MotionEvent.ACTION_MOVE:                xUp= (int) ev.getX();                yDown= (int) ev.getY();                if(xUp-xDown>10||xUp-xDown<-10){                    return false;                }                break;            case MotionEvent.ACTION_UP:                xUp= (int) ev.getX();                if(xUp-xDown>10||xUp-xDown<-10){                    return false;                }                break;        }        return super.onInterceptTouchEvent(ev);    }}

阅读全文
0 0
原创粉丝点击