VerificationCodeView

Android 自定义方形输入框,仿滴滴验证码、小篮单车验证码输入框

V1.0.1 版 效果图

b34f472544e1b0b09ff7f2b074b5c3d3.gif

fix bug :暗文密码模式无效果问题

update :添加输入框平分等间距模式,并可设置输入框间距

update :添加清空输入框方法

update :修改Listener,添加文本改变时回调方法

监听

public interface OnCodeFinishListener {

/**

* 文本改变

*/

void onTextChange(View view, String content);

/**

* 输入完成

*/

void onComplete(View view, String content);

}

attr

Gradle

Step 1. Add it in your root build.gradle at the end of repositories:

allprojects {

repositories {

...

maven { url 'https://jitpack.io' }

}

}

Step 2. Add the dependency

dependencies {

compile 'com.jyn.verificationcodeview:verificationcodeview:1.0.1'

}

用法

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginTop="10dp"

android:gravity="center"

android:orientation="horizontal"

app:vcv_et_bg="@drawable/et_code_test1"

app:vcv_et_cursor="@drawable/et_cursor"

app:vcv_et_cursor_visible="false"

app:vcv_et_inputType="numberPassword"

app:vcv_et_number="6"

app:vcv_et_spacing="6dp"

app:vcv_et_text_color="#FFC107"

app:vcv_et_text_size="6sp" />

vcv_et_bg 背景示例(默认)

vcv_et_cursor 光标示例(默认)

android:shape="rectangle">

备注:V1.0.0 版在 branch - V1.0.0

开发思路

如果对您有帮助的话,还请给个star,谢谢!

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐