Android Otp View

Android Otp View

An OTP Box implementation for case when a single digit should be entered Individually. 

Installation in your Project

Step 1. Add the JitPack repository to your build file. Add it in your root build.gradle at the end of repositories:

Step 2. Add the dependency

How to use the library?

Just add the following to your xml design to show the otpview

To get a callback when the user enters the otp make use of OTPListener Interface

you also get some additional methods like :

Thats all for now but new additions will be made frequently.

OtpView Attributes

AttributeUse
android:textColorsets the color of the otp text
app:otpsets the otp in the otp view
app:lengthsets the no of otp box in the otp view
app:otp_text_sizesets the otp text size in the otp view
app:text_typefacesets the otp text typeface in the otp view
app:hide_otpsets if the otp entered is to be shown to the user
app:hide_otp_drawablereplaces the pin bullet which is shown to the user when hide_otp is enabled
app:heightsets the height of each box inside the otp view
app:widthsets the width of each box inside the otp view
app:box_marginsets the space between each box in otp view
app:box_margin_leftsets the left space between each box in otp view
app:box_margin_rightsets the right space between each box in otp view
app:box_margin_topsets the top space of each box in otp view
app:box_margin_bottomsets the bottom space of each box in otp view
app:bar_enabledshows a bar below each otp box to the user
app:bar_heightsets the bar height
app:bar_marginsets the bar margin within each box in otp view
app:bar_margin_leftsets the bar left margin within each box in otp view
app:bar_margin_rightsets the bar right margin within each box in otp view
app:bar_margin_topsets the bar top margin within each box in otp view
app:bar_margin_bottomsets the bar bottom margin within each box in otp view
app:bar_active_colorsets the bar color when the cursor is on the box in otp view
app:bar_inactive_colorsets the bar color when the cursor is not on the box in otp view
app:bar_error_colorsets the bar color for error state in otp view
app:bar_success_colorsets the bar color for success state in otp view
app:otp_box_backgroundsets the box background in otp view
app:otp_box_background_activesets the box background when the cursor is on the box in otp view
app:otp_box_background_inactivesets the box background when the cursor is not on the box in otp view
app:otp_box_background_errorsets the box background for error state in otp view
app:otp_box_background_successsets the box background for success state in otp view

Author

Maintained by Aabhas Jindal

Contribution

676 total views, 1 views today

(Visited 271 times, 1 visits today)

You May Also Like

About the Author: Android Developer

This is Mohammad I am Android Application Developer. I am the founder of Android Tutorial Online blog. I am programming lover and professional blogger from India. I spend most of my time doing programming and helping other programmers. This Android tutorial online blog for learning and share Android code.
My Chatbot
Powered by Replace Me