美文网首页安卓集中营安卓开发Android开发积累
ClearEditText: 带清除按钮输入框,支持输入普通文字

ClearEditText: 带清除按钮输入框,支持输入普通文字

作者: 蓝不蓝编程 | 来源:发表于2019-01-30 17:02 被阅读24次

功能描述

带清除按钮输入框,支持输入普通文字、数字、密码;支持分段显示身份证、手机号、银行卡。


image.png

调用方法:

  1. 添加依赖包
  • 项目根目录下build.gradle的allprojects->repositories下增加maven { url 'https://jitpack.io' }
  • app工程目录下build.gradle的dependencies中增加implementation 'com.github.cxyzy1:clearEditText:1.0.1'
  1. xml中使用样例
<com.cxyzy.cet.ClearEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="请输入手机号"
        app:input_type="phone" />

input_type可选值和含义:
common:普通文字信息(不做任何限制)
phone:手机号(11位,分隔显示样例:155 8080 7070)
bank_card_no:银行卡(每四位增加一个分隔符,如:6200 1111 0000)
id_card_no:身份证号(样例:410022 1990 0404 6623)
password:密码
number:数字,包含小数点(不做分段显示)

源代码

https://github.com/cxyzy1/clearEditText

安卓开发技术分享: https://www.jianshu.com/p/442339952f26

相关文章

网友评论

    本文标题:ClearEditText: 带清除按钮输入框,支持输入普通文字

    本文链接:https://www.haomeiwen.com/subject/tyscsqtx.html