簡體   English   中英

RecyclerView 上的 Android SwipeRefreshLayout 反向布局

[英]Android SwipeRefreshLayout on RecyclerView with reverse layout

我在 Android 的 SwipeRefreshLayout 中使用 RecyclerView。

<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>

在這個 RecyclerView 中,我使用的是帶有反向布局和堆棧的 LinearLayoutManager:

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

myRecyclerView.setLayoutManager(layoutManager);

因此,滾動內容從底部開始,項目由適配器從下到上添加。

使用此配置,當 RecyclerView 位於底部並且用戶嘗試向下滾動時,我想顯示 SwipeRefreshLayout。 相反,結果是 SwipeRefreshLayout 具有標准行為,並且當用戶滾動到頂部並且 RecyclerView 位於頂部時從上到下顯示動畫。

我沒有找到 apis 來做到這一點,我該如何解決這個問題?

謝謝

我解決了使用這個庫,因為 SwipeRefreshLayout 不支持反向布局

刷新布局底部

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM