Android(安卓)验证码输入框 连续性粘贴 使用第三方包
第一步
android {
compileOptions{ sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8}
dependencies {
implementation 'com.github.Wynsbin:VerificationCodeInputView:1.0.2'
}
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
第二步
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="48dp"
android:gravity="center"
android:orientation="horizontal"
app:vciv_et_background="@android:color/white"
app:vciv_et_foucs_background="@android:color/holo_orange_dark"
app:vciv_et_cursor_color="@color/colorPrimary"
app:vciv_et_height="58dp"
app:vciv_et_inputType="number"
app:vciv_et_number="6"
app:vciv_et_text_color="@android:color/black"
app:vciv_et_text_size="18sp"
app:vciv_et_underline_default_color="@android:color/holo_green_dark"
app:vciv_et_underline_focus_color="@android:color/holo_blue_bright"
app:vciv_et_underline_height="2dp"
app:vciv_et_underline_show="true"
app:vciv_et_width="58dp" />
第三步
VerificationCodeInputView view = findViewById(R.id.vciv_code);
view.setOnInputListener(new VerificationCodeInputView.OnInputListener() {
@Override
public void onComplete(String code) {
Toast.makeText(MainActivity.this, code, Toast.LENGTH_SHORT).show();
}
@Override
public void onInput() {
}
});
//清除验证码
view.clearCode();
详情参考:https://blog.csdn.net/qq_30552993/article/details/102582641
更多相关文章
- JNI 无法确定Bitmap的签名
- android studio 生成 release aar
- 参考注释郭霖老师的Android相机程序
- 【Android平台】 Alljoyn学习笔记四 Android(安卓)Core API参考
- Android的ListView,数据更新后自动scroll到底部。
- Android非UI线程访问UI线程的方法总结
- Windows下Eclipse 安装 android maven插件教程
- 2011.06.03(2)——— android 1.6 launcher研究之自定义ViewGroup
- 2011.06.03(2)——— android 1.6 launcher研究之自定义ViewGroup