swiperefreshlayout
SwipeRefreshLayout with scrollView and Layout above
I found that if you replace your ScrollView with a android.support.v4.widget.NestedScrollView the scrolling behavior will work as you expect it to.
How to use the SwipeRefreshLayout?
I don’t know what that ActionBarActivity class you’re extending is, but I got it working just fine using a FragmentActivity public class ActivityMain extends FragmentActivity implements OnRefreshListener { private SwipeRefreshLayout mSwipeRefreshLayout; @Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.container); mSwipeRefreshLayout.setOnRefreshListener(this); super.onCreate(savedInstanceState); } @Override public void onRefresh() { Toast.makeText(this, “Refresh”, Toast.LENGTH_SHORT).show(); new Handler().postDelayed(new … Read more
SwipeRefreshLayout behind ActionBar
In the Material Design version of the appcompat-v7 library (v21.0.0), SwipeRefreshLayout gets a method to set the Progress View offset. https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html#setProgressViewOffset(boolean,%20int,%20int) public void setProgressViewOffset (boolean scale, int start, int end) The refresh indicator starting and resting position is always positioned near the top of the refreshing content. This position is a consistent location, but can … Read more
SwipeRefreshLayout + WebView when scroll position is at top
I’ve managed to solve it without having to extend anything. Have a look at this snippet (Fragment-specific): private ViewTreeObserver.OnScrollChangedListener mOnScrollChangedListener; @Override public void onStart() { super.onStart(); swipeLayout.getViewTreeObserver().addOnScrollChangedListener(mOnScrollChangedListener = new ViewTreeObserver.OnScrollChangedListener() { @Override public void onScrollChanged() { if (mWebView.getScrollY() == 0) swipeLayout.setEnabled(true); else swipeLayout.setEnabled(false); } }); } @Override public void onStop() { swipeLayout.getViewTreeObserver().removeOnScrollChangedListener(mOnScrollChangedListener); super.onStop(); } For … Read more
SwipeRefreshLayout disable drag animation on swipe down
Try calling: setEnabled(false) on your SwipeRefreshLayout view.
How to set SwipeRefreshLayout refreshing property using android data binding?
No need to hack. The key is to look for the public methods in SwipeRefreshLayout documentation. In general, Databinding will look for the corresponding name without the set part. E.g. you’ll find there: setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) setRefreshing(boolean refreshing) The OnRefreshListener Since OnRefreshListener is a public interface, with a single method, you can directly use this in … Read more
Scroll up does not work with SwipeRefreshLayout in Listview
In order for SwipeRefreshLayout to work, it needs to be the direct parent of your ListView, and the ListView should be the first active child view of the SwipeRefreshLayout. The documentation for SwipeRefreshLayout says that the ListView should be the only child, but it is okay if it has more than one child as long … Read more