У меня есть макет ниже.RecyclerView не может прокручиваться, когда вставляются в RelativeView и SwipeToRefresh
<?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>
Это в основном имеющие recyclerView
внедренный в SwipeToRefresh
. Это хорошо работает, когда я могу прокручивать свой recyclerView вверх и вниз. Когда вы достигаете вершины, и я спускаюсь, появляется Refresh.
Учитывая, что мне нужно добавить пустой вид Динамически, я обернул пустой вид и 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