为RecyclerView瀑布流添加foot时的一些问题
来源:互联网 发布:js数组前面添加元素 编辑:程序博客网 时间:2024/05/20 19:46
根据viewType判断了对应position填充的布局后,在OnBindViewHolder中为foot布局设置setFullSpan(),
StaggeredGridLayoutManager.LayoutParams layoutParams1 = (StaggeredGridLayoutManager.LayoutParams)holder.itemView.getLayoutParams();if (layoutParams1==null){ return;}layoutParams1.setFullSpan(true);但是这样会有一个问题,在数据不多,或者说第一页加载的时候,layoutParam1为空,导致不能够正确显示充满全屏,可以改代码如下所示,可解决问题
StaggeredGridLayoutManager.LayoutParams lp = new StaggeredGridLayoutManager.LayoutParams( StaggeredGridLayoutManager.LayoutParams.WRAP_CONTENT,StaggeredGridLayoutManager.LayoutParams.WRAP_CONTENT);holder.itemView.setLayoutParams(lp);StaggeredGridLayoutManager.LayoutParams layoutParams1 = (StaggeredGridLayoutManager.LayoutParams)holder.itemView.getLayoutParams();if (layoutParams1==null){ return;}layoutParams1.setFullSpan(true);
0 0
- 为RecyclerView瀑布流添加foot时的一些问题
- RecyclerView的瀑布流
- 复杂RecyclerView的实现(添加底部瀑布流效果)
- 对RecyclerView的ViewType的使用以及添加Foot和Head的心得
- RecyclerView做的瀑布流
- 解决瀑布流recyclerview的闪烁移动问题
- 关于RecyclerView实现瀑布流,上下滑动时item之间互换位置的问题
- 关于RecyclerView实现瀑布流,上下滑动时item之间互换位置的问题
- RecyclerView加载瀑布流,图片自适应问题
- 使用RecyclerView实现滑动添加、滑动删除,以及瀑布流、ListView、GridView的转换
- Android RecyclerView 的瀑布流式布局
- Android RecyclerView 的基本使用--瀑布流
- RecyclerView之瀑布流的事件监听
- RecyclerView的简单应用3:瀑布流
- RecyclerView的简单瀑布流效果
- RecyclerView瀑布流的简单实现
- 基于RecyclerView的瀑布流实现
- 使用RecyclerView展示瀑布流的效果
- 关于Pairs(对组)
- linux 下 select 函数的用法
- Java基础-集合框架4 Set接口
- 深信服超融合基础架构管理平台--虚拟存储测试实践
- PHP的常用函数(四)
- 为RecyclerView瀑布流添加foot时的一些问题
- centos6.5hadoop2.7部署和简单例子
- 路帮网的加油站开放接口
- Java中的浮点数比较 == equals 和 compare
- 配置Tomcat服务器
- Spark History Server配置使用
- android developer tiny share-20161108
- Android实用的正则表达式工具
- 使用iText导出word和pdf(经典)