scwang90 / SmartRefreshLayout

🔥下拉刷新、上拉加载、二级刷新、淘宝二楼、RefreshLayout、OverScroll,Android智能下拉刷新框架,支持越界回弹、越界拖动,具有极强的扩展性,集成了几十种炫酷的Header和 Footer。
https://segmentfault.com/a/1190000010066071
Apache License 2.0
24.87k stars 4.94k forks source link

recycview遮挡住最底部布局 #1160

Open kimiangel opened 4 years ago

kimiangel commented 4 years ago

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

deng81416754 commented 4 years ago

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

KarenKaKa commented 4 years ago

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

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

sdwfqin commented 4 years ago

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

hkhv commented 4 years ago

我也遇到了相同的问题

hkhv commented 4 years ago

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

image
calmerman commented 4 years ago

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

star-andy commented 3 years ago

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

image

这个方式有效

CodeK1988 commented 3 years ago

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

oyl1love commented 3 years ago

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

Mrxxy commented 3 years ago

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

JacksenLaw commented 3 years ago

嵌套也不行啊

queyiqin commented 2 years ago

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 commented 2 years ago

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

   ui.rvResultList.doOnPreDraw {
        ui.rvResultList.layoutParams.also {
            it.height = ui.refresh.height
        }
    }
ZDZN commented 1 year ago

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

payne1107 commented 12 months ago

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

WeiLianYang commented 11 months ago

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

yangfeng1994 commented 11 months ago

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