VerificationCodeView
Android 自定义方形输入框,仿滴滴验证码、小篮单车验证码输入框
效果图
GIF被压缩的有点模糊,下面是截图
用法
android:id="@+id/verificationcodeview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center"
android:orientation="horizontal"
app:vcv_et_bg="@drawable/et_login_code"
app:vcv_et_cursor="@drawable/et_cursor"
app:vcv_et_inputType="number"
app:vcv_et_number="4"
app:vcv_et_text_color="@android:color/black"
app:vcv_et_text_size="6sp" />
输入完成监听
verificationcodeview.setOnCodeFinishListener(new VerificationCodeView.OnCodeFinishListener() {
@Override
public void onComplete(String content) {
textView.setText(content);
}
});
所有属性
vcv_et_bg 背景示例(默认)
vcv_et_cursor 光标示例(默认)
android:shape="rectangle">
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.0'
}
开发思路
如果对您有帮助的话,还请给个star,谢谢!