In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "Android how to customize the CAPTCHA input box", the content is easy to understand, clear, hope to help you solve the doubt, the following let the editor lead you to study and learn "Android how to customize the CAPTCHA input box" this article.
Demand
1. You can customize the number and style of input boxes
2. Support long press paste or clipboard content automatic filling (paste continuity)
The second point is the most important. It is precisely that other people do not have this point and force themselves to get one.
Principle
Roughly Edittext + n * TextView, then set the edittext font and background color to transparent, hide the cursor
Edittext: monitor edittext assign a value to the corresponding TextView every time you enter a character, and then clear yourself
Underline: add View under TextView
Cursor: the focus cursor for each TextView here actually sets the ValueAnimator for the View
Paste: paste pop-up window is a custom PopupWindow
There are detailed comments on the source code, so I won't explain them all here.
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
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 () {}}); / / clear CAPTCHA view.clearCode ()
Attributes
VCInputType
Input box background color support type
1. @ drawable/xxx
2. @ color/xxx
3 、 # xxxxxx
The above is all the contents of the article "how to customize the CAPTCHA input box for Android". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.