在下拉刷新SwipRefreshLayout为根布局时会无法显示状态图
在下拉刷新SwipRefreshLayout为根布局时会无法显示除succ以外的状态图,其它下拉框架应该也是一样,讨论里面的解决方案都不可用,不建议使用
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</android.support.v4.widget.SwipeRefreshLayout>
val statusLayoutManager = StatusLayoutManager.Builder(recyclerView).build()
没问题! SmartRefreshLayout 也可以!
@zhuwenhao 你多嵌套了一层,我一开始也是这么想的,空数据的时候确实好像可以用,但当数据超过屏幕,也就就内心层list 可以滑动的时候就会看出来问题了,会与下拉刷新手势冲突,你可以试试。
@kakarrot 并没有发现和下拉刷新有冲突
我的理解是 StatusLayoutManager builder 里面的view 不能是根布局 代码这样写: statusLayoutManager = new StatusLayoutManager.Builder(smartRefreshLayout) 布局文件这样写
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <com.scwang.smartrefresh.layout.SmartRefreshLayout android:id="@+id/smartRefreshLayout_common" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent" /> </com.scwang.smartrefresh.layout.SmartRefreshLayout> </FrameLayout>