【发布时间】:2017-11-28 13:03:09
【问题描述】:
我有一个按预期工作的 RecyclerView,我尝试添加一个滑动来刷新布局,如下所示:
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/srl_contacts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/senderContainer"
android:layout_below="@id/tv_connection_status">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_chat_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:padding="10dp"
android:paddingBottom="3dp"
android:paddingTop="3dp"
android:scrollbars="none"></android.support.v7.widget.RecyclerView>
</android.support.v4.widget.SwipeRefreshLayout>
RecyclerView 工作正常,但没有刷卡刷新,然后我评论了我将线性布局管理器设置为 RecyclerView 和刷卡刷新实现的行,并调用了OnRefresh() 接口
在java中:
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRvList.setLayoutManager(layoutManager); // <----- i commented this , and every thing worked fine , there was no data shown of course.
可能是适配器的问题?我删除了我为 RecyclerView 设置适配器的每一行,问题仍然存在,只有当我没有设置线性布局管理器时,滑动才能刷新。
【问题讨论】:
标签: android android-layout android-recyclerview material-design swiperefreshlayout