今天,我在优快云写一篇技术文章,是我自己在Android开发中总结提炼出的一个自定义控件EditListView,下面主要对其功能及其使用做简单介绍。
首先,我们来看一下效果演示图:
接下来,我们讲解一下控件功能及其使用:
1.功能
封装列表控件,使其条目具有可编辑选择、删除等功能。
2.Android Studio使用方法
dependencies{
compile 'com.wkp:EditListView:1.0.2'
//Android Studio3.0+可用以下方式
//implementation 'com.wkp:EditListView:1.0.2'
}
3.使用详解
- 属性讲解
<!--是否开启测量高度-->
<attr name="wkp_measureHeight" format="boolean"/>
<!--未选中状态时图标-->
<attr name="wkp_uncheckedImg" format="reference"/>
<!--选中状态时图标-->
<attr name="wkp_checkedImg" format="reference"/>
<!--编辑/退出编辑动画时长(默认200)-->
<attr name="wkp_editAnimDuration" format="integer"/>
- 布局示例
<!--activity_main.xml-->
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/sv"
android:layout_width="match_parent"