Skip to content

Instantly share code, notes, and snippets.

@EdenStack
Last active September 17, 2016 06:03
Show Gist options
  • Save EdenStack/568388a1dbe83595529081d661f0e966 to your computer and use it in GitHub Desktop.
Save EdenStack/568388a1dbe83595529081d661f0e966 to your computer and use it in GitHub Desktop.
SwipeRefreshlayout that handle scroll event confilct with viewgroup .
package com.credit.checktool.ui;
import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewGroup;
public class CustSwipeRefreshLayout extends SwipeRefreshLayout {
private ViewGroup viewGroup;
public CustSwipeRefreshLayout(Context context) {
super(context);
}
public CustSwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ViewGroup getViewGroup() {
return viewGroup;
}
public void setViewGroup(ViewGroup viewGroup) {
this.viewGroup = viewGroup;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (null != viewGroup) {
return viewGroup.getScrollY() <= 1 && super.onInterceptTouchEvent(ev);
}
return super.onInterceptTouchEvent(ev);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment