仿微信、支付寶等簡潔的驗證碼、密碼輸入框

VerificationCodeInput

簡潔驗證碼輸入框,能自定義輸入框個數(shù)和樣式。

驗證碼輸入控件

How to use

<com.dalimao.corelibrary.VerificationCodeInput
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ver:box="4"
        ver:child_h_padding="5dp"
        android:layout_centerInParent="true"
        android:id="@+id/verificationCodeInput"
        android:layout_marginBottom="16dp"
        />

監(jiān)聽輸入完成:

VerificationCodeInput input = (VerificationCodeInput) findViewById(R.id.verificationCodeInput);
input.setOnCompleteListener(new VerificationCodeInput.Listener() {
      @Override
      public void onComplete(String content) {
         Log.d(TAG, "完成輸入:" + content);
      }
});

你還可以為輸入框定義自己的樣式,指定屬性 box_bg_normal 和 box_bg_focus:

<com.dalimao.corelibrary.VerificationCodeInput
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ver:box="4"
        ver:box_bg_normal="@drawable/verification_edit_bg_normal"
        ver:box_bg_focus="@drawable/verification_edit_bg_focus"
        ver:child_h_padding="5dp"
        android:layout_centerInParent="true"
        android:layout_marginBottom="16dp"
        />

自定義個數(shù),指定屬性 box:

<com.dalimao.corelibrary.VerificationCodeInput
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ver:box="5"
        ver:box_bg_normal="@drawable/verification_edit_bg_normal"
        ver:box_bg_focus="@drawable/verification_edit_bg_focus"
        ver:child_h_padding="5dp"
        android:layout_centerInParent="true"
        android:layout_marginBottom="16dp"
        />
樣式定義

Gradle dependencies

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.github.liuguangli:VerificationCodeInput:1.2'
}

源碼

點這兒

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 178,872評論 25 709
  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,533評論 19 139
  • 開始閱讀本篇文章之前先來說一下使用場景吧,我們知道如今移動支付已經(jīng)占據(jù)我們?nèi)粘VЦ兜?0%的份額,以微信支付和支付...
    lygttpod閱讀 17,928評論 29 70
  • 《長城·饕餮傳》 文/ 子曰:誠 昨天咆哮回來,斷了一只爪,身負(fù)重傷。 我問它怎么回事,它說遇到了幾個人類。 吃了...
    子曰誠閱讀 1,373評論 2 9
  • 你說陽春三月 期待不到一場雪 那曾經(jīng)是銀白色的枝頭 現(xiàn)在,到處都是花開的聲音 已經(jīng)過去的季節(jié),就好像 一場意猶未盡...
    孫思迪閱讀 397評論 0 0

友情鏈接更多精彩內(nèi)容