Skip to content

Instantly share code, notes, and snippets.

@kelvinc1024
Created September 26, 2018 02:38
Show Gist options
  • Save kelvinc1024/e59ca62c41af71ec3781c7d1afe3ed5f to your computer and use it in GitHub Desktop.
Save kelvinc1024/e59ca62c41af71ec3781c7d1afe3ed5f to your computer and use it in GitHub Desktop.
CustomTargetScrollSwipeRefreshLayout
import android.content.Context;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;
public class CustomSwipeRefreshLayout extends SwipeRefreshLayout {
private View mScrollView;
public CustomSwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setScrollView(View view) {
this.mScrollView = view;
}
@Override
public boolean canChildScrollUp() {
if (mScrollView != null) {
return ViewCompat.canScrollVertically(mScrollView, -1);
}
return super.canChildScrollUp();
}
public interface onEmbededScrollView {
void setScrollView(View view);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment