android 侧滑删除库,高仿IOS,QQ

今天要介绍的这个库叫做 SwipeDelMenuLayout

1 史上最简单侧滑菜单,0耦合,支持任意ViewGroup

2 一步集成侧滑(删除)菜单,高仿QQ、IOS

首先看下效果

这里写图片描述

侧滑删除库github地址

使用方法如下:

1 导入依赖库

allprojects {
    repositories {
       ....
        maven { url "https://jitpack.io" }  //根目录build.gradle
    }
}
dependencies {
    ...
    compile 'com.github.mcxtzhang:SwipeDelMenuLayout:V1.2.5'//目前最新版本是1.2.5,主项目目录build.gradle
}

2 布局引用

因为一般删除都是侧滑Item,所以需要找到你的item布局文件,举例:

<?xml version="1.0" encoding="utf-8"?>
<!--注意根布局是SwipeMenuLayout -->
<com.mcxtzhang.swipemenulib.SwipeMenuLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="50dp">
        <ImageView
            android:id="@+id/icon_in"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@mipmap/ic_launcher"/>
        <TextView
            android:id="@+id/text_in"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="我是艾克"
            android:gravity="center"
            android:textSize="15sp"/>
    </LinearLayout>
    <!--上面是你的item原本的内容-->
<!--下面是你侧滑之后要显示的内容,比如置顶,标记未读,删除等等-->
    <Button
        android:id="@+id/btnDelete"
        android:layout_width="80dp"
        android:layout_height="50dp"
        android:background="#ff0000"
        android:text="删除"
        android:textColor="@android:color/white"/>

</com.mcxtzhang.swipemenulib.SwipeMenuLayout>

剩下的就是写你的删除按钮的逻辑了,这个很简单,就不赘述啦,希望大家喜欢这个库~

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值