I have RecyclerView above that i have an AppBarLayout whose height is larger than 255 px. When user scrolls RecyclerView, AppBarLayout has an fling issue. To avoid that i decided to expand AppBarLayout manually. My RecyclerView made of GridLayoutManager with span of 3. I used below code to listen RecyclerView top reach
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
int firstVisiblePosition = ((LinearLayoutManager)recyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition();
if (firstVisiblePosition == 0) {
appBarLayout.setExpanded(true, true);
}
}
}
});