android 全选功能,Android Recyclerview实现多选,单选,全选,反选,批量删除的功能

效果图如下:

5b6c88c98f2a1dbdda10e0819b80d5b8.png 

1772f5f758047c043ebca779fe3399c9.png 

d03fbfd6bbd36825bb438e50dd1a4012.png

Recyclerview 实现多选,单选,全选,反选,批量删除的步骤

1.在Recyclerview布局中添加上底部的全选和反选按钮,删除按钮,和计算数量等控件

2.这里选中的控件没有用checkBox来做,用的是imageview,选中和不选中其实是两张图片

3.默认是不显示选中的控件的,点击编辑的时候显示,点击取消的时候隐藏

4.通过adapter和activity数据之间的传递,然后进行具体的操作

具体代码如下:

在recyclerview的布局中写全选,删除,计数等相应的控件

android:id="@+id/ll_mycollection_bottom_dialog"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="vertical"

android:layout_gravity="bottom"

android:visibility="gone"

android:background="@color/app_bg">

android:background="#e5e5e5"

android:layout_width="match_parent"

android:layout_height="1px"/>

android:background="@color/white"

android:layout_width="match_parent"

android:layout_height="@dimen/px_90">

android:layout_centerVertical="true"

android:id="@+id/tv"

android:textColor="#1A1A1A"

android:textSize="@dimen/px_28"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginLeft="@

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值