lubilis
lubilis

Reputation: 4170

Android SwipeRefreshLayout on RecyclerView with reverse layout

I'm using a RecyclerView inside a SwipeRefreshLayout in Android.

<android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/mySwipeRefresh"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1">

    <RecyclerView
        android:id="@+id/myRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</android.support.v4.widget.SwipeRefreshLayout>

In this RecyclerView i'm using a LinearLayoutManager with reverse layout and stack from end:

LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
layoutManager.setReverseLayout(true);
layoutManager.setStackFromEnd(true);

myRecyclerView.setLayoutManager(layoutManager);

So, the scrolling content starts from bottom and items are added by adapter from bottom to top.

With this configuration, i'd like to show SwipeRefreshLayout when RecyclerView is at the bottom and user try scrolling more down. Instead, the results is that SwipeRefreshLayout has the standard behavior and is shown from top to bottom animation when user scrolls to top and RecyclerView is at the top.

I didn't find apis to do this, how can i solve this issue?

Thanks

Upvotes: 2

Views: 3192

Answers (1)

lubilis
lubilis

Reputation: 4170

I resolved using this library since SwipeRefreshLayout doesn't support reverse layout

Refresh layout bottom

Upvotes: 1

Related Questions