手把手教你给RecycleView添加头布局和尾布局

  RecycleView想必大家都不陌生,它已他的高拓展性取代了传统布局显示,同时配合协调布局,可以实现很多意想不到的酷炫交互,今天就和大家介绍一下,如何给RecycleView添加头布局和尾布局,同时你也可以通过自己的拓展实现更多复杂的布局。

首先我们先看一下效果:

 

实现头部尾部布局其实方法还是很多,这里我推荐使用Adapter设置itemType来做,那么问题来了,为什么这么做呢?因为拓展性更强,并且更加解耦。将逻辑都写在adapter中,比起写在activity中管理起来也更加方便。

首先,我们需要明确一点,什么是head,什么是foot,当位于第一个item的时候就是head,最后一个就是foot.之后我们根据不同的itemType加载出来就可以了。

第一步判断头尾部以及内容区域:

private int getBodySize() {
        return listData.size();
    }
    private boolean isHead(int position) {
        return headCount!=0&&position<headCount;
    }
    private boolean isFoot(int position) {
        return footCount!=0&&(position>=(getBodySize()+headCount));
    }
    public int getItemViewType(int position) {
        if (isHead(position)) {
            return HEAD_TYPE;
        }else if (isFoot(position)) {
            return FOOT_TYPE;
        }else {
            return BODY_TYPE;
        }
    }

根据不同的ViewType生产不同的Holder

@Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        switch (viewType) {
            case HEAD_TYPE:
                return new HeadViewHolder(mLayoutInflater.inflate(R.layout.trend_head,parent,false));
            case BODY_TYPE:
                return new BodyViewHolder(mLayoutInflater.inflate(R.layout.itemview_trend,parent,false));
            case FOOT_TYPE:
                return new FootViewHolder(mLayoutInflater.inflate(R.layout.trend_bottom,parent,false));
            default:
                return null;
        }


    }

拿到不同的holder生产具体实现:

@Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (holder instanceof HeadViewHolder) {

        }else if (holder instanceof BodyViewHolder) {
            ((BodyViewHolder) holder).body.setText((CharSequence) listData.get(position-headCount));

        }else if (holder instanceof FootViewHolder) {

        }

    }

怎么样是不是很简单?其实还可以拓展实现更多样式的item只需要我们设置itemtype和位置就可以了。最后附上完整代码。

public class HBRecycleViewAdapter<T> extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
    private static final int HEAD_TYPE=00001;
    private static final int BODY_TYPE=00002;
    private static final int FOOT_TYPE=00003;
    private int headCount=1;//头部个数,后续可以自己拓展
    private int footCount=1;//尾部个数,后续可以自己拓展
    private LayoutInflater mLayoutInflater;
    private List<T>listData=new ArrayList<>();
    public HBRecycleViewAdapter(Context context,List<T>listData) {
        //this.context=context;
        mLayoutInflater=LayoutInflater.from(context);
        this.listData=listData;
    }
    private int getBodySize() {
        return listData.size();
    }
    private boolean isHead(int position) {
        return headCount!=0&&position<headCount;
    }
    private boolean isFoot(int position) {
        return footCount!=0&&(position>=(getBodySize()+headCount));
    }
    @Override
    public int getItemViewType(int position) {
        if (isHead(position)) {
            return HEAD_TYPE;
        }else if (isFoot(position)) {
            return FOOT_TYPE;
        }else {
            return BODY_TYPE;
        }
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        switch (viewType) {
            case HEAD_TYPE:
                return new HeadViewHolder(mLayoutInflater.inflate(R.layout.trend_head,parent,false));
            case BODY_TYPE:
                return new BodyViewHolder(mLayoutInflater.inflate(R.layout.itemview_trend,parent,false));
            case FOOT_TYPE:
                return new FootViewHolder(mLayoutInflater.inflate(R.layout.trend_bottom,parent,false));
            default:
                return null;
        }


    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (holder instanceof HeadViewHolder) {

        }else if (holder instanceof BodyViewHolder) {
            ((BodyViewHolder) holder).body.setText((CharSequence) listData.get(position-headCount));

        }else if (holder instanceof FootViewHolder) {

        }

    }

    @Override
    public int getItemCount() {
        return headCount+getBodySize()+footCount;
    }
    private static class HeadViewHolder extends RecyclerView.ViewHolder{

        public HeadViewHolder(View itemView) {
            super(itemView);
        }
    }
    private static class BodyViewHolder extends RecyclerView.ViewHolder{
        TextView body;
        public BodyViewHolder(View itemView) {
            super(itemView);
            body= (TextView) itemView.findViewById(R.id.tv_body);
        }
    }
    private static class FootViewHolder extends RecyclerView.ViewHolder {

        public FootViewHolder(View itemView) {
            super(itemView);
        }
    }
}

 

转载于:https://www.cnblogs.com/lovelyYakir/p/6159822.html

RecyclerView 添加头部和尾部布局 RecyclerView 出来有很长一段时间了,相信大家对它已经很熟悉了,使用过它的朋友可能都会发现一点,就是 RecyclerView 不能添加 headerView 和 footView,这就让我们有点蛋疼了 阅读详情

相关推荐

使用RecyclerViewHeader一键添加RecyclerView头布局并实现轮播效果 实例源码下载

使用RecyclerViewHeader一键添加RecyclerView头布局并实现轮播效果

Android RecyclerView添加头部和底部布局,支持上拉刷新、下拉加载

本文参考辉哥的博客RecyclerView更全解析之 - 打造通用的下拉刷新上拉加载进行实现,具体代码实现思路可查看原博客,目的是通过自定义自己实现添加头部、添加底部、上拉加载、下拉刷新功能。通过自己动手实现一套下拉刷新上拉加载框架,了解了RecyclerView添加Header以及Footer的实现原理,通过本次学习也看到了代码剥离拆分以及设计模式运用的重要性,写代码一定要多思考,才能写出让人赏心悦目的代码。

故不积跬步无以至千里 4550

RecyclerView的基本使用、封装、多条目布局、添加头部和底部

RecyclerView万能adapter的封装,多条目布局的实现,RecyclerView添加头部和底部的实现

RecyclerView的添加头部布局

忙碌一天,仔细一想,也就深入了解了一下RecyclerView,改了点bug。朋友在做一个类似朋友圈的页面,大体的看了下布局,感觉挺简单,但实际做起来并没有这么容易。大概就是一个RecyclerView,然后写一个item就能搞定的事,细节处理比较多,写一下步骤吧一个Item,大体布局:<LinearLayout xmlns:android="http://schemas.android.com/a

a516972602的博客 1339

Geant4 学习笔记(一):实现multi-thread多线程

简单修改实现Geant4多线程

weixin_52417815的博客 6084

嵌入式开发必备:手把手教你用DB-9连接器搞定RS-232串口通信(附万用表测试技巧)

本文详细解析了嵌入式开发中RS-232串口通信的硬件连接核心。从DB-9连接器的引脚定义入手,深入讲解DTE与DCE设备角色,明确直连线与交叉线的选择法则,并重点分享了使用万用表进行线缆连通性测试、电压测量及故障诊断的实战技巧,帮助开发者彻底掌握串口通信的硬件连接与排查方法。

tgb345678的博客 1166

Android实现RecyclerView分组显示功能完整示例(自定义组头和Item布局)

这样,我们就实现了RecyclerView的分组功能。在GroupAdapter中,我们重写了getItemCount()、getItemViewType()、onCreateViewHolder()和onBindViewHolder()方法,使其能够支持分组。在Activity或Fragment中,我们创建了RecyclerView和GroupAdapter,并将其设置为RecyclerView的Adapter,从而实现了分组功能。 在这个示例中,我们使用了RelativeLayout布局来包含Recy

wh445306 4076

Unity Acceleratorc与Cache Server unity的缓存服务器

文章目录1.作用概述2.用法(使用,看这个就够了)服务端下载部署Unity Acceleratorc修改http管理端口修改Editor连接端口客户端使用(设置好一次提交设置,团队拉取即可全部生效)3.测试平台切换测试资源导入测试(打开编辑器的情况下)项目启动测试(不打开编辑器的情况下)4.不同版本表现5.服务端监控6.服务端缓存7.冲突8.预警9.不同项目/不同配置-同种资源10.缓存清除 1.作用概述 编辑器模式下,导入资源,切换平台unity都会重新识别资源,大型项目很浪费时间,使用Cache Ser

euphorias的博客 3812

一句代码搞定 RecycleView 侧滑菜单、添加头部底部、加载更多 , 像 Glide 一样简洁的链式调用轻松实现 Adapter

SlideAdapter 项目地址:yhaolpz/SlideAdapter  简介:一句代码搞定 RecycleView 侧滑菜单、添加头部底部、加载更多 , 像 Glide 一样简洁的链式调用轻松实现 Adapter 更多:作者   提 Bug   官网    标签:   在 动手打造史上最简单的 Recycleview 侧滑菜单 中,萌生了将这种方案封装为一个开源库的想法,旨在实...

未来很长,但我会努力的走下去。 289

别再为淘宝滑块发愁了!一个Python脚本自动获取x5sec cookie的保姆级教程

本文提供了一套完整的Python自动化解决方案,帮助开发者轻松应对淘宝滑块验证码问题。通过模拟浏览器行为、精准识别滑块缺口位置和生成拟人化移动轨迹,脚本能够自动获取关键的x5sec cookie,显著提升爬虫效率。教程涵盖环境配置、验证机制分析、代码实现及反检测策略,是解决淘宝滑块验证的实用指南。

weixin_30300225的博客 574

BugkuCTF-PWN题pwn2-overflow超详细讲解

解题思路 1)计算出get_shell_的地址偏移量 2)算出来之后就直接溢出到后门函数 知识点 x64函数调用规则 解题之前我们先学下linux x64的函数调用规则。 x64机器在调用某个函数前,比如int func(int a, int b, int c, int d, int e, int f, int g, int h),首先他会把前6个参数从左往右存入到寄存器rdi、rsi、rdx、rcx、r8、r9,其余参数存入到栈里,保存的顺序是从右往左入栈。比如abcdef会存入到寄存器里,然后一次入栈h

am_03的博客 3013

RecycleView添加头部

项目中有用到RecycleView实现刷新功能,添加头部,功能终于实现了,记录一下(仍有待完善,各位看官,仅供参考)首先是在一个activity里面使用fragment+viewPager实现功能需求activity界面布局;首先activity layout布局:&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:...

贪吃的小耳朵的博客 607

2025电赛嵌入式:K210教程-如何刷固件 如何烧录代码 全网唯一

本文介绍了K210开发板的固件刷写和开发环境搭建方法。主要内容包括:1)从Sipeed官网下载合适的MaixPy固件,根据需求选择完整版或精简版;2)使用k-flash等工具烧录固件,注意区分亚博和Sipeed开发板的固件版本;3)介绍了擦除闪存的两种模式(部分擦除和完全擦除)及其应用场景;4)搭建CanMV开发环境,通过MaixPy IDE连接开发板并进行程序调试。文章还提供了常见问题的解决方法,如串口驱动安装、固件兼容性检查等,为K210开发提供了完整的入门指南。

FJN110的博客 546

android 给多列的RecycleView添加头布局

在工作中遇到商城类的界面,界面上半部分是viewpager,下部分是多列的GridView,具体实现: 1、在设置RecycleView的manager时使用GridlayoutManager的 setSpanSizeLookup属性设置头布局所占的宽度: manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup()

yikunhan的博客 2056

39、高频 LLC 谐振转换控制系统动态优化算法分析与研究

本文针对高频下LLC谐振转换器动态性能差的问题,提出一种基于谐振电容器充放电估计动态切换时间的优化控制算法。通过改进状态轨迹控制方法,突破传统算法在谐振频率与开关频率相等条件下的限制,并结合新型采样策略有效抑制电压过冲。算法在MATLAB和SABER中完成仿真验证,并搭建基于STM32F407的原型系统进行测试,结果表明该方法显著缩短动态响应时间,提升系统稳定性。研究为高频、高功率密度开关电源的动态优化提供了可行解决方案。

linux6sysadmin的博客 111

嵌入式u-boot最全面试题及参考答案(5万字长文持续更新)

例如,在一个便携式设备中,U-Boot 在启动时初始化电源控制器,将输出电压设置为合适的值。命令是u-boot构建过程中用于配置u-boot选项的命令。在嵌入式系统中,启动画面(也称为启动Logo或Splash Screen)是展示给用户的第一印象,它可以包含公司的标志、产品的名称或其他相关信息。u-boot允许通过环境变量来进行配置,这使得开发者可以根据不同的硬件平台和项目需求灵活地调整u-boot的行为。写入操作可以是字节级别的,也可以是块级别的,具体取决于设备的性能和操作系统的需求。

大模型大数据攻城狮的专栏 997

RecycleView加头布局和尾布局

RecycleView万能适配器ViewHolder主页面INTERESTING!!! 其实这就是一种写法和一种思路,并不难 主要是为了实现布局自由(头和尾) 思路是 先将头尾布局传进适配器, 在返回条目类型和绑定时进行判断是否赋值 思路简单,还是看代码吧 public class XMyAdapter extends RecyclerView.Adapter<VHolder> { ...

qiu_suo的博客 231

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

第十九天-RecyclerView添加头布局、尾布局和RecyclerView扩展侧滑删除

第十九天-RecyclerView添加头布局、尾布局和RecyclerView扩展侧滑删除RecyclerView添加头布局步骤代码实现1、布局文件:2、代码实现3、 效果展示RecyclerView扩展侧滑删除SwipLayout注意常用方法代码:注意:其他代码上方均有代码图片!!! RecyclerView添加头布局 步骤 1、添加表示类型的常量(头、尾、普通) 2、ViewHolder类中将...

王号伦-WZL 451

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

RecyclerView添加头布局和尾布局

1,添加一个头布局 - 1,Xml布局 &amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt; &amp;lt;android.support.constraint.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&qu

EleganceKing的博客 9132

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

RecycleView添加头布局底布局,点击事件,多布局

Activity: 1:初始化控件 @BindView(R.id.recyclerviewhead) public RecyclerView recyclerviewhead; public ArrayList&lt;String&gt; data ; public MyRecycleViewAdapter adapter; :添加数据 ButterKnife.bind(this); /...

qq_35957672的博客 628

RecycleView添加头布局尾布局

所有得逻辑操作都在adapter中 package com.example.myapplication; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.vie...

mintent的博客 402

RecyclerView 添加头布局 和 底布局

RecyclerView 添加头布局 和 底布局 RecyclerView 默认是没有添加头部和底部布局的方法。而在listView我们经常会用到list.addHreadView,list.addFooterView,而在recyclerView是不提供这种方法的,这可如何是好。于是观察了listView 是如何添加头布局和底部布局的,模拟li...

tiger_gy的博客 3387

RecycleView添加头布局显示异常的问题

最近项目中的列表都是用recycleview做的,有些需要添加头布局,可是头布局在模拟器显示正常,但是在真机显示的宽度为正常的一半。通过查看其他资料知道,recycleview的头布局根节点不能为Linearlayout.在自己布局之外套个相对布局就可以了

xunhaifeng521的博客 2201

Android 为Recyclerview添加头布局,下拉刷新,上拉加载

框架地址:https://github.com/XRecyclerView/XRecyclerView本文只是针对这个框架的使用1、引入依赖: compile 'com.jcodecraeer:xrecyclerview:1.3.2'2、布局使用XRecycler:&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;com.jcodecraeer.x...

随风的博客 1608

recycleview的头布局和尾部局

package com.bwie.recyclerviewheader; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.support.v7.wi

fangdong 448
上一篇: 判断viewpager左右滑动方向
下一篇: Java中精确的数字计算类BigDecimal
diebing0439
博客等级 码龄11年 0粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值