我有以下布局。在RelativeView和SwipeToRefresh下嵌入时,RecyclerView无法向上滚动
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
它基本上具有嵌入在SwipeToRefresh
一个recyclerView
。这适用于我可以上下滚动我的recyclerView的地方。当到达顶端,我拉下来,刷新发生。
鉴于我需要动态地添加一个空视图,我已将空视图和RecyclerView
包装在RelativeLayout
下。这如下。
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include
android:id="@+id/my_empty_view"
layout="@layout/fragment_empty_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</RelativeLayout>
</android.support.v4.widget.SwipeRefreshLayout>
通过添加该RelativeLayout
的RecyclerView
和SwipeToRefreshLayout
之间的RecyclerView
只能向下滚动。它不能向上滚动,因为每当我尝试向上滚动时,都会发生SwipeToRefresh
。
为什么这是一个问题?有没有办法在保留我的布局的情况下解决问题?
谢谢!
显然,问题在https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type报道%20Status%20Owner%20Summary%20Stars&GROUPBY =&排序=&ID = 78191。 – Elye