VercodeEditText

An Android vercode EditText.(一个安卓验证码输入控件.仿[探探验证码输入控件])

Stars
468

介绍

一个安卓验证码输入框控件。 VercodeEditText

演示

防止输入溢出.

特性

  • 继承EditText,可以当作EditText使用
  • 防止输入溢出
  • 自定义验证码位数
  • 提供输入内容的监听器
  • 高度自适配
  • 属性自定义配置
  • 光标属性自定义

版本

名称 SlideMenuLayout
最新 VercodeEditText

配置

Maven

<dependency>
  <groupId>com.justkiddingbaby</groupId>
  <artifactId>vercodeedittext</artifactId>
  <version>最新版本</version>
  <type>pom</type>
</dependency>

JCenter

第一步,添加至工程的build.gradle文件中

repositories {
    jcenter()
}

第二步,添加至module的build.gradle文件中

'com.justkiddingbaby:vercodeedittext:最新版本'

属性说明

属性 介绍 取值
figures 验证码位数 integer
verCodeMargin 每个验证码的间隔 dimension
bottomLineSelectedColor 底线选择状态下的颜色 reference
bottomLineNormalColor 底线未选中状态下的颜色 reference
bottomLineHeight 底线高度 dimension
selectedBackgroundColor 选中的背景颜色 reference
cursorDuration 光标闪烁间隔时间 integer
cursorColor 光标颜色 integer
cursorWidth 光标宽度 integer

方法说明

返回值 方法 说明
void setFigures(int figures) 设置验证码位数
void setVerCodeMargin(int margin) 设置验证码之间的间隔
void setBottomSelectedColor(int bottomSelectedColor) 设置底线选中状态的颜色
oid setBottomNormalColor(int bottomNormalColor) 设置底线未选中状态的颜色
void setSelectedBackgroundColor(int selectedBackground) 设置验证码选中的背景颜色
void setBottomLineHeight(int bottomLineHeight) 设置验证码底线的高度
void setOnVerificationCodeChangedListener(OnVerificationCodeChangedListener listener) 设置验证码变化的监听器

使用

在布局中使用

  <com.jkb.vcedittext.VerificationCodeEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number"
        android:text="123"
        android:textColor="@color/colorPrimary"
        android:textSize="40sp"
        app:bottomLineHeight="2dp"
        app:bottomLineNormalColor="@color/gravy_light"
        app:bottomLineSelectedColor="@color/colorAccent"
        app:figures="4"
        app:selectedBackgroundColor="@color/colorPrimary_alpha33"
        app:verCodeMargin="10dp" />

发布历史

v1.1.0 (2018/11/1)

1、添加光标属性的支持.

v1.0.5(2017/12/5)

1、修复在点击控件时候可以遇到的Bug

v1.0.4(2017/10/14)

1、在AndroidManifest.xml中移除label节点.

v1.0.3(2017/8/15)

1、让接口类VerificationAction变为public.

v1.0.2(2017/6/29)

1、修复AndroidMainfest.xml中application标签下allowBackup属性为false的冲突.

v1.0.1(2017/6/27)

1、修复点击后无法获取焦点问题.

v1.0.0(2017/6/12)

1、发布VercodeEditText控件,防止输入溢出. 2、封装demo.

Badges
Extracted from project README
Platform SDK
Related Projects