Android: CoordinatorLayout and SwipeRefreshLayout

Set the scroll behavior to the SwipeRefreshLayout not the RecyclerView. <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id=”@+id/swipe_container” android:layout_width=”match_parent” android:layout_height=”match_parent” app:layout_behavior=”@string/appbar_scrolling_view_behavior”> <androidx.recyclerview.widget.RecyclerView android:id=”@+id/cardList” android:layout_width=”match_parent” android:layout_height=”match_parent” android:scrollbars=”vertical” /> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

HorizontalScrollView inside SwipeRefreshLayout

I solved it by extending SwipeRefreshLayout and overriding its onInterceptTouchEvent. Inside, I calculate if the X distance the user has wandered is bigger than the touch slop. If it does, it means the user is swiping horizontally, therefor I return false which lets the child view (the HorizontalScrollView in this case) to get the touch … Read more

RecyclerView and SwipeRefreshLayout

write the following code in addOnScrollListener of the RecyclerView Like this: recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener(){ @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { int topRowVerticalPosition = (recyclerView == null || recyclerView.getChildCount() == 0) ? 0 : recyclerView.getChildAt(0).getTop(); swipeRefreshLayout.setEnabled(topRowVerticalPosition >= 0); } @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } });

Android: CollapsingToolbarLayout and SwipeRefreshLayout get stuck

Update: This issue has been resolved in the latest version of the support library (23.1.1+). If you are using an older version of the support library either upgrade or continue reading. If you’re using an older version of the support library, add an offset change listener to your AppBarLayout to enable or disable your swipe … Read more

SwipeRefreshLayout trigger programmatically

if you are using the new swipeRefreshLayout intoduced in 5.0 As the image shown above you just need to add the following line to trigger the swipe refresh layout programmatically Work in Java: mSwipeRefreshLayout.post(new Runnable() { @Override public void run() { mSwipeRefreshLayout.setRefreshing(true); } }); on in Kotlin: mSwipeRefreshLayout.post { mSwipeRefreshLayout.isRefreshing = true } NOT work … Read more

When switch fragment with SwipeRefreshLayout during refreshing, fragment freezes but actually still work

Well… After some struggling I eventually solved this problem by myself, in a tricky way… I just need to add these in onPause() : @Override public void onPause() { super.onPause(); … if (mSwipeRefreshLayout!=null) { mSwipeRefreshLayout.setRefreshing(false); mSwipeRefreshLayout.destroyDrawingCache(); mSwipeRefreshLayout.clearAnimation(); } }

How to disable “pull to refresh” action and use only indicator?

From the documentation: If an activity wishes to show just the progress animation, it should call setRefreshing(true). To disable the gesture and progress animation, call setEnabled(false) on the view. So to show the animation: swiperefreshLayout.setEnabled(true); swiperefreshLayout.setRefreshing(true); And to hide the animation: swiperefreshLayout.setRefreshing(false); swiperefreshLayout.setEnabled(false);

SwipeRefreshLayout + ViewPager, limit horizontal scroll only?

I am not sure if you still have this issue but Google I/O app iosched solves this problem thusly: viewPager.addOnPageChangeListener( new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled( int position, float v, int i1 ) { } @Override public void onPageSelected( int position ) { } @Override public void onPageScrollStateChanged( int state ) { enableDisableSwipeRefresh( state … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)