2017-06-25 18:24:50 +08:00
|
|
|
|
<img src="/img/VercodeEditTex.png" width="800px"/>
|
|
|
|
|
|
|
2017-06-12 16:45:14 +08:00
|
|
|
|
## 介绍
|
2017-06-19 10:35:29 +08:00
|
|
|
|
一个安卓验证码输入框控件。
|
2017-06-12 16:45:14 +08:00
|
|
|
|
[](http://developer.android.com/index.html)
|
|
|
|
|
|
<img src="https://img.shields.io/badge/license-Apache 2.0-green.svg?style=flat">
|
2017-06-29 15:34:22 +08:00
|
|
|
|
[](https://android-arsenal.com/api?level=11)
|
2017-06-29 15:31:25 +08:00
|
|
|
|

|
2017-06-12 16:45:14 +08:00
|
|
|
|
|
2017-06-27 11:22:25 +08:00
|
|
|
|
## 演示
|
2017-06-12 16:45:14 +08:00
|
|
|
|
防止输入溢出.
|
|
|
|
|
|
<img src="/img/demo.gif" width="280px"/>
|
|
|
|
|
|
|
2017-06-27 11:22:25 +08:00
|
|
|
|
## 特性
|
2017-06-12 16:45:14 +08:00
|
|
|
|
- [x] **继承EditText,可以当作EditText使用**
|
|
|
|
|
|
- [x] **防止输入溢出**
|
|
|
|
|
|
- [x] **自定义验证码位数**
|
|
|
|
|
|
- [x] **提供输入内容的监听器**
|
2017-06-13 09:08:44 +08:00
|
|
|
|
- [x] **高度自适配**
|
|
|
|
|
|
- [x] **属性自定义配置**
|
|
|
|
|
|
|
2017-06-27 11:22:25 +08:00
|
|
|
|
## 版本
|
2017-06-13 09:08:44 +08:00
|
|
|
|
名称|SlideMenuLayout
|
|
|
|
|
|
---|---
|
2017-06-29 15:31:25 +08:00
|
|
|
|
最新|
|
2017-06-13 09:08:44 +08:00
|
|
|
|
|
2017-06-27 11:22:25 +08:00
|
|
|
|
## 配置
|
2017-06-13 09:08:44 +08:00
|
|
|
|
#### Maven
|
|
|
|
|
|
```xml
|
|
|
|
|
|
<dependency>
|
|
|
|
|
|
<groupId>com.justkiddingbaby</groupId>
|
|
|
|
|
|
<artifactId>vercodeedittext</artifactId>
|
|
|
|
|
|
<version>最新版本</version>
|
|
|
|
|
|
<type>pom</type>
|
|
|
|
|
|
</dependency>
|
|
|
|
|
|
```
|
|
|
|
|
|
#### JCenter
|
|
|
|
|
|
第一步,添加至工程的build.gradle文件中
|
|
|
|
|
|
```gradle
|
|
|
|
|
|
repositories {
|
|
|
|
|
|
jcenter()
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
第二步,添加至module的build.gradle文件中
|
|
|
|
|
|
```gradle
|
|
|
|
|
|
compile 'com.justkiddingbaby:vercodeedittext:最新版本'
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 属性说明
|
|
|
|
|
|
属性|介绍|取值
|
|
|
|
|
|
---|---|---
|
2017-06-29 15:31:25 +08:00
|
|
|
|
[figures](/vcedittext-lib/src/main/res/values/attrs.xml)|验证码位数|integer
|
|
|
|
|
|
[verCodeMargin](/vcedittext-lib/src/main/res/values/attrs.xml)|每个验证码的间隔|dimension
|
|
|
|
|
|
[bottomLineSelectedColor](/vcedittext-lib/src/main/res/values/attrs.xml)|底线选择状态下的颜色|reference
|
|
|
|
|
|
[bottomLineNormalColor](/vcedittext-lib/src/main/res/values/attrs.xml)|底线未选中状态下的颜色|reference
|
|
|
|
|
|
[bottomLineHeight](/vcedittext-lib/src/main/res/values/attrs.xml)|底线高度|dimension
|
|
|
|
|
|
[selectedBackgroundColor](/vcedittext-lib/src/main/res/values/attrs.xml)|选中的背景颜色|reference
|
2017-06-13 09:23:26 +08:00
|
|
|
|
|
|
|
|
|
|
## 方法说明
|
|
|
|
|
|
返回值|方法|说明
|
|
|
|
|
|
---|---|---
|
2017-06-29 15:31:25 +08:00
|
|
|
|
void|[setFigures(int figures)](/vcedittext-lib/src/main/java/com/jkb/vcedittext/VerificationAction.java)|设置验证码位数
|
|
|
|
|
|
void|[setVerCodeMargin(int margin)](/vcedittext-lib/src/main/java/com/jkb/vcedittext/VerificationAction.java)|设置验证码之间的间隔
|
|
|
|
|
|
void|[setBottomSelectedColor(int bottomSelectedColor)](/vcedittext-lib/src/main/java/com/jkb/vcedittext/VerificationAction.java)|设置底线选中状态的颜色
|
|
|
|
|
|
|oid|[setBottomNormalColor(int bottomNormalColor)](/vcedittext-lib/src/main/java/com/jkb/vcedittext/VerificationAction.java)|设置底线未选中状态的颜色
|
|
|
|
|
|
void|[setSelectedBackgroundColor(int selectedBackground)](/vcedittext-lib/src/main/java/com/jkb/vcedittext/VerificationAction.java)|设置验证码选中的背景颜色
|
|
|
|
|
|
void|[setBottomLineHeight(int bottomLineHeight)](/vcedittext-lib/src/main/java/com/jkb/vcedittext/VerificationAction.java)|设置验证码底线的高度
|
|
|
|
|
|
void|[setOnVerificationCodeChangedListener(OnVerificationCodeChangedListener listener)](/vcedittext-lib/src/main/java/com/jkb/vcedittext/VerificationAction.java)|设置验证码变化的监听器
|
2017-06-13 09:23:26 +08:00
|
|
|
|
|
|
|
|
|
|
## 使用
|
|
|
|
|
|
#### 在布局中使用
|
|
|
|
|
|
```xml
|
|
|
|
|
|
<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" />
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 发布历史
|
2017-08-15 20:57:01 +08:00
|
|
|
|
#### v1.0.3(2017/8/15)
|
|
|
|
|
|
1、让接口类VerificationAction变为public.
|
2017-06-29 15:31:25 +08:00
|
|
|
|
#### v1.0.2(2017/6/29)
|
|
|
|
|
|
1、修复AndroidMainfest.xml中application标签下allowBackup属性为false的冲突.
|
2017-06-27 11:22:25 +08:00
|
|
|
|
#### v1.0.1(2017/6/27)
|
|
|
|
|
|
1、修复点击后无法获取焦点问题.
|
2017-06-13 09:23:26 +08:00
|
|
|
|
#### v1.0.0(2017/6/12)
|
|
|
|
|
|
1、发布VercodeEditText控件,防止输入溢出.
|
2017-06-19 10:35:29 +08:00
|
|
|
|
2、封装demo.
|