欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來(lái)到入門教程網(wǎng)!

Android

當(dāng)前位置:主頁(yè) > 軟件編程 > Android >

Android 自定義驗(yàn)證碼輸入框的實(shí)例代碼(支持粘貼連續(xù)性)

來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:Android|點(diǎn)擊: 次

需求

1、能自定義輸入框個(gè)數(shù)和樣式

2、支持長(zhǎng)按粘貼或剪切板內(nèi)容自動(dòng)填充(粘貼連續(xù)性)

其中第2點(diǎn)是最為重要的,正是其他人沒(méi)有這點(diǎn),逼得自己弄一個(gè)

示例

別人的示例:

粘貼居然不支持連續(xù)性,只能粘貼第一個(gè)字符,所以用的有點(diǎn)難受

自己的示例:

原理

大致是Edittext + n* TextView,然后設(shè)置edittext字體跟背景顏色都為透明,隱藏光標(biāo)

Edittext:監(jiān)聽(tīng)edittext每次輸入一個(gè)字符就賦值到對(duì)應(yīng)的TextView上,然后在清空自己

下劃線:在TextView下面添加View

光標(biāo):這里的每個(gè)TextView的焦點(diǎn)光標(biāo)其實(shí)對(duì)View設(shè)置了ValueAnimator

粘貼:粘貼彈窗是自定義的PopupWindow

源碼有詳細(xì)注釋,這里就不一一說(shuō)明

Github

https://github.com/WShaobin/VerificationCodeInputView

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 {
  implementation 'com.github.WShaobin:VerificationCodeInputView:1.0.2'
}

How to use

In layout

<com.wynsbin.vciv.VerificationCodeInputView
  android:id="@+id/vciv_code"
  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" />

In Java Code

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() {

  }
});

//清除驗(yàn)證碼
view.clearCode();

Attributes

VCInputType

 

 輸入框背景色支持類型

1、@drawable/xxx

2、@color/xxx

3、#xxxxxx

總結(jié)

以上所述是小編給大家介紹的Android 自定義驗(yàn)證碼輸入框的實(shí)例代碼(支持粘貼連續(xù)性),希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)我們網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

上一篇:Android生成條形碼和二維碼功能

欄    目:Android

下一篇:Android實(shí)現(xiàn)自動(dòng)輪詢的RecycleView

本文標(biāo)題:Android 自定義驗(yàn)證碼輸入框的實(shí)例代碼(支持粘貼連續(xù)性)

本文地址:http://mengdiqiu.com.cn/a1/Android/9150.html

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有