SmartRefreshLayout
SmartRefreshLayout copied to clipboard
recycview遮挡住最底部布局
我的recycview用的vlayout布局,所以里面有很多内容,当我拉到最底部的时候,然后首页会慢慢往上滑一部分,遮盖住了最底层的内容,这是为什么呢
我也遇到同样问题……我是viewpager2+fragment里面的recycview 最后一个item被遮挡
我也遇到同样问题……我是viewpager2+fragment里面的recycview 最后一个item被遮挡
我也遇到了同样的问题,viewpager2的height不能设置为0,最后只能把约束布局改成线性布局,并把viewpager2的高设置成match_parent
NavHostFragment+ConstraintLayout也遇到了这个问题,现在用的LinearLayout+权重可以了
我也遇到了相同的问题
我解决了,,在recyclerviewr 外面加一个约束布局,,现在是 viewpage2 + fragment + smartrefresh

遇到同样问题,在recyclerview 外层在嵌套一个约束布局解决的
我解决了,,在recyclerviewr 外面加一个约束布局,,现在是 viewpage2 + fragment + smartrefresh
这个方式有效
场景1 SmartRefreshLayout + viewpager recyclerview RecyclerView 套一层 FrameLayout 即可正常显示
场景2 SmartRefreshLayout+CoordinatorLayout+FrameLayout(LayoutInflater +RecyclerView) 即可正常显示
尝试了很多次,SmartRefreshLayout + ConstraintLayout+ RecyclerView 情况下RecyclerView 设置 android:layout_height="0px"才正常 ( android:layout_height="match_parent"不要用,这样还是有问题)
上述方法都有尝试,还是不行,使用View.doOnPreDraw方法,手动设置高度后可以正常显示
嵌套也不行啊
ViewPager2 +Fragment
我解决了
-
viewPager2 高度不能为 0 <androidx.viewpager2.widget.ViewPager2 android:id="@+id/viewpager2" android:layout_width="match_parent" android:layout_height="match_parent"
/>
-
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" android:focusable="true" android:focusableInTouchMode="true">
<com.scwang.smart.refresh.layout.SmartRefreshLayout android:id="@+id/refresh" style="@style/SmartRefreshLayoutStyle" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" app:srlEnableLoadMore="false"> <com.nineread.common.view.RefreshHeader android:layout_width="match_parent" android:layout_height="wrap_content" /> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/rv_result_list" android:layout_width="match_parent" android:layout_height="0dp" android:nestedScrollingEnabled="true" android:orientation="vertical" android:overScrollMode="never" android:scrollbars="none" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="parent" /> <include layout="@layout/layout_loading_state_page" android:layout_width="match_parent" android:layout_height="0dp" app:callback="@{callback}" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="parent" app:resource="@{resource}" /> </androidx.constraintlayout.widget.ConstraintLayout> <com.scwang.smart.refresh.footer.ClassicsFooter style="@style/ClassicsFooterStyle" android:layout_width="match_parent" android:layout_height="wrap_content" /> </com.scwang.smart.refresh.layout.SmartRefreshLayout>
就是这样!!
参考 的回答,这样可能更好,不然配合 BaseQuickAdapter 会闪烁,下面直接用SmartRefreshLayout的宽度给RecyclerView即可。
ui.rvResultList.doOnPreDraw {
ui.rvResultList.layoutParams.also {
it.height = ui.refresh.height
}
}
某些情况 doOnPreDraw 会有问题,改用 doOnLayout 也可以
遇到同样问题,在recyclerview 外层在嵌套一个约束布局解决的 感谢前辈
ViewPager2 + Fragment + SmartRefreshLayout + RecyclerView 碰到相同的问题,最后一个 item 被 footer 遮挡,RecyclerView 的 ViewHolder 的 onBindViewHolder 方法被重复调用。现在在最外层的 ViewPager 套上一个 LinearLayout ,android:layout_height="match_parent" 。问题解决了
使用外层嵌套约束布局,会造成RecyclerView的子View点击事件有冲突,需要滑动一下才行,并且导致onBindViewHolder 无限被调用