CymChad / BaseRecyclerViewAdapterHelper

BRVAH:Powerful and flexible RecyclerAdapter
http://www.recyclerview.org/
MIT License
24.2k stars 5.14k forks source link

4.x加载更多没能适配其他类型的 LayoutManager #3801

Closed Dboy233 closed 8 months ago

Dboy233 commented 10 months ago

目前只在 LinearlayoutManger 下正常。其他类型的 LayoutManager 异常。

adongs commented 10 months ago

解决方法: 在你的代码 var helper = QuickAdapterHelper.Builder(adapter).build() 指定 helper.trailingLoadState = LoadState.NotLoading(false) 就可以了

Dboy233 commented 10 months ago

解决方法:

在你的代码 var helper = QuickAdapterHelper.Builder(adapter).build()

指定 helper.trailingLoadState = LoadState.NotLoading(false) 就可以了

老哥,加在更多是一个占满全列的视图,如果是网格布局就会导致加在更多变成了一个某一列的item,而不能自成一行单列

xylitol679 commented 9 months ago

StaggeredGridLayoutManager在TrailingLoadStateAdapter中重写onViewAttachedToWindow。

override fun onViewAttachedToWindow(holder: CustomLoadMoreVH) {
    super.onViewAttachedToWindow(holder)
    val lp = holder.itemView.layoutParams
    if (lp is StaggeredGridLayoutManager.LayoutParams) {
        lp.isFullSpan = true
    }
}
xylitol679 commented 9 months ago

GridLayoutManager使用QuickGridLayoutManager替代即可,其他Adapter需要满跨度的,可实现FullSpanAdapterType接口。

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:layoutManager="com.chad.library.adapter.base.layoutmanager.QuickGridLayoutManager"
    app:spanCount="4"
    tools:listitem="@layout/item_list" />
Dboy233 commented 9 months ago

GridLayoutManager使用QuickGridLayoutManager替代即可,其他Adapter需要满跨度的,可实现FullSpanAdapterType接口。

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:layoutManager="com.chad.library.adapter.base.layoutmanager.QuickGridLayoutManager"
    app:spanCount="4"
    tools:listitem="@layout/item_list" />

@xylitol679 这个方法可以

tu2460 commented 9 months ago

@xylitol679 大佬,这个问题在3.0.7版本我这边也遇到了,就是瀑布流上拉加载更多偶现在某个item下,如果要自己处理该怎么处理呢

limuyang2 commented 8 months ago

更新 4.0.3再次尝试