【发布时间】:2017-02-12 07:54:34
【问题描述】:
您好,我有一个片段,其中包含两个 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>
我尝试在底部的 RecyclerView 上调用invalidate(),但没有奏效。任何帮助将不胜感激,谢谢!
【问题讨论】:
-
你能粘贴你的适配器的代码吗?当一个项目从顶部回收器视图中删除时你在做什么
标签: android android-layout android-recyclerview