我使用了带有 recyclerivew 的刷卡刷新。但我看到一个问题。我无法向上滚动我的 recyclerivew。我可以正常向下滚动 recyclerview,但每次我尝试向上滚动时,它都不会向上滚动,它正在运行快速刷新功能,但我还没有滚动到顶部。 这是我的 xml
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginBottom="-5dp"
android:id="@+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/buslayout"
android:focusableInTouchMode="true"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:layout_gravity="center"
android:gravity="center"
android:text="Loading..."
android:id="@+id/info"
android:visibility="visible"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/business_recycle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
最佳答案
试试这个:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginBottom="-5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:layout_gravity="center"
android:gravity="center"
android:text="Loading..."
android:id="@+id/info"
android:visibility="visible"/>
<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/swiperefresh"
android:focusableInTouchMode="true"
>
<android.support.v7.widget.RecyclerView
android:id="@+id/business_recycle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>
关于android - 如何使用带有 recyclerview 的滑动刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41309922/