Espresso, scrolling not working when NestedScrollView or RecyclerView is in CoordinatorLayout

This is happening because the Espresso scrollTo() method explicitly checks the layout class and only works for ScrollView & HorizontalScrollView. Internally it’s using View.requestRectangleOnScreen(…) so I’d expect it to actually work fine for many layouts. My workaround for NestedScrollView was to take ScrollToAction and modify that constraint. The modified action worked fine for NestedScrollView with … Read more

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>

ConstraintLayout vs Coordinator layout?

CoordinatorLayout is a super-powered FrameLayout. CoordinatorLayout CoordinatorLayout is intended for two primary use cases: As a top-level application decor or chrome layout As a container for a specific interaction with one or more child views By default, if you add multiple children to a FrameLayout, they would overlap each other. A FrameLayout should be used … Read more