嗨,我有一個包含兩個RecyclerView的碎片,一個在另一個之上。當佈局在上面縮小時,向上移動佈局
第一個是用戶採取行動的項目列表,第二個是採取行動後項目將被填充的位置。所以當一個項目從頂部列表中刪除時,它會被添加到底部列表中。
我遇到的問題是當我從頂部RecyclerView中刪除一個項目時,頂部RecyclerView中的所有剩餘項目向上移動以填充被刪除項目留下的空間,但是這會在頂部和底部之間留下間隙RecyclerViews。
我如何可以移動底部recyclerview,以填補在一次創建一個項目是從頂部RecyclerView
去除。這裏的差距是我的佈局XML
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:layout_alignParentTop="true"
android:id="@+id/pending_tasks"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:layout_below="@id/pending_tasks"
android:id="@+id/completed_tasks"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
我曾嘗試在呼叫invalidate()
底部RecyclerView但沒有奏效。任何幫助將不勝感激,謝謝!
可以粘貼您的適配器的代碼和你在做什麼,當一個項目從頂部recyclerview刪除 – Dibzmania