Last active
September 17, 2016 06:03
-
-
Save EdenStack/568388a1dbe83595529081d661f0e966 to your computer and use it in GitHub Desktop.
SwipeRefreshlayout that handle scroll event confilct with viewgroup .
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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