android瀑布流,完美解决滑动过程中item位置错乱,下拉刷新顶部空白,加载更多顶部错乱等问题

本文介绍了如何使用StaggerdRecyclerView实现Android瀑布流布局,并解决了在滑动过程中item位置错乱、下拉刷新时顶部空白以及加载更多时顶部错乱的问题。内容包括集成步骤、基本用法、其他功能如动画效果、设置间距、禁止刷新和加载更多,以及详细解释了这些问题出现的原理。

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

StaggerdRecyclerView

android瀑布流,完美解决滑动过程中item位置错乱,下拉刷新顶部空白,加载更多顶部错乱等问题,还可以实现动画效果

效果图

在这里插入图片描述

集成

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

dependencies {
	        implementation 'com.github.moo611:StaggerdRecyclerView:latestversion'
	}

基本用法

1.布局文件里添加

<com.atech.staggedrv.StaggerdRecyclerView
    android:id="@+id/str"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

2.您的model,需要实现StaggedModel接口
//示例 example
public class FakeModel implements StaggedModel {
   
   
 
    private int width;
    private int height;
    private int resourceId;

    public FakeModel(int width, int height, int resourceId){
   
   
        this.width = width;
        this.height = height;
        this.resourceId = resourceId;
    }



    @Override
    public int getWidth

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值