SmartRefreshLayout icon indicating copy to clipboard operation
SmartRefreshLayout copied to clipboard

recycview遮挡住最底部布局

Open kimiangel opened this issue 5 years ago • 17 comments

我的recycview用的vlayout布局,所以里面有很多内容,当我拉到最底部的时候,然后首页会慢慢往上滑一部分,遮盖住了最底层的内容,这是为什么呢

kimiangel avatar May 21 '20 06:05 kimiangel

我也遇到同样问题……我是viewpager2+fragment里面的recycview 最后一个item被遮挡

deng81416754 avatar May 21 '20 07:05 deng81416754

我也遇到同样问题……我是viewpager2+fragment里面的recycview 最后一个item被遮挡

我也遇到了同样的问题,viewpager2的height不能设置为0,最后只能把约束布局改成线性布局,并把viewpager2的高设置成match_parent

KarenKaKa avatar Jul 08 '20 06:07 KarenKaKa

NavHostFragment+ConstraintLayout也遇到了这个问题,现在用的LinearLayout+权重可以了

sdwfqin avatar Jul 09 '20 05:07 sdwfqin

我也遇到了相同的问题

hkhv avatar Jul 24 '20 18:07 hkhv

我解决了,,在recyclerviewr 外面加一个约束布局,,现在是 viewpage2 + fragment + smartrefresh image

hkhv avatar Jul 25 '20 11:07 hkhv

遇到同样问题,在recyclerview 外层在嵌套一个约束布局解决的

calmerman avatar Aug 06 '20 07:08 calmerman

我解决了,,在recyclerviewr 外面加一个约束布局,,现在是 viewpage2 + fragment + smartrefresh image

这个方式有效

star-andy avatar Oct 13 '20 05:10 star-andy

场景1 SmartRefreshLayout + viewpager recyclerview RecyclerView 套一层 FrameLayout 即可正常显示
场景2 SmartRefreshLayout+CoordinatorLayout+FrameLayout(LayoutInflater +RecyclerView) 即可正常显示

CodeK1988 avatar Oct 29 '20 01:10 CodeK1988

尝试了很多次,SmartRefreshLayout + ConstraintLayout+ RecyclerView 情况下RecyclerView 设置 android:layout_height="0px"才正常 ( android:layout_height="match_parent"不要用,这样还是有问题)

oyl1love avatar Apr 21 '21 02:04 oyl1love

上述方法都有尝试,还是不行,使用View.doOnPreDraw方法,手动设置高度后可以正常显示

Mrxxy avatar May 26 '21 06:05 Mrxxy

嵌套也不行啊

JacksenLaw avatar Jul 12 '21 03:07 JacksenLaw

ViewPager2 +Fragment

我解决了

  1. viewPager2 高度不能为 0 <androidx.viewpager2.widget.ViewPager2 android:id="@+id/viewpager2" android:layout_width="match_parent" android:layout_height="match_parent"

    />

  2. <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>
    

就是这样!!

queyiqin avatar Nov 25 '21 03:11 queyiqin

参考 的回答,这样可能更好,不然配合 BaseQuickAdapter 会闪烁,下面直接用SmartRefreshLayout的宽度给RecyclerView即可。

   ui.rvResultList.doOnPreDraw {
        ui.rvResultList.layoutParams.also {
            it.height = ui.refresh.height
        }
    }

queyiqin avatar Nov 25 '21 06:11 queyiqin

某些情况 doOnPreDraw 会有问题,改用 doOnLayout 也可以

ZDZN avatar Oct 17 '22 09:10 ZDZN

遇到同样问题,在recyclerview 外层在嵌套一个约束布局解决的 感谢前辈

payne1107 avatar Sep 04 '23 06:09 payne1107

ViewPager2 + Fragment + SmartRefreshLayout + RecyclerView 碰到相同的问题,最后一个 item 被 footer 遮挡,RecyclerView 的 ViewHolder 的 onBindViewHolder 方法被重复调用。现在在最外层的 ViewPager 套上一个 LinearLayout ,android:layout_height="match_parent" 。问题解决了

WeiLianYang avatar Sep 15 '23 06:09 WeiLianYang

使用外层嵌套约束布局,会造成RecyclerView的子View点击事件有冲突,需要滑动一下才行,并且导致onBindViewHolder 无限被调用

yangfeng1994 avatar Sep 26 '23 01:09 yangfeng1994