简体   繁体   中英

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

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

Refresh layout bottom

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM