Probably the most captcha-like input control that supports properties.
Introduction of depend on
Implementation 'com. Simple: VerCodeLayout: 1.0.0'Copy the code
The basic use
Use the VerCodeEditText control
<com.simple.vclayout.VerCodeEditText
android:id="@+id/vcEt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:vcCount="6"
app:vcFocusedBackground="@drawable/sp_focused_one"
app:vcMargin="5dp"
app:vcNormalBackground="@drawable/sp_normal_one"
app:vcTextSize="20sp" />Copy the code
Available properties
The property name | role |
---|---|
vcCount | The number of the EditText |
vcMaxLength | EditText Maximum input length |
vcNormalBackground | Unselected background |
vcFocusedBackground | Selected background |
vcWidth | The EditText wide |
vcHeight | The EditText high |
vcMinWidth | The minimum width of EditText |
vcMinHeight | The minimum height of EditText |
vcMargin | Margins in EditText, and of course small properties like MarginLeft |
vcPadding | The inner margin of the EditText, and of course small properties like PaddingLeft |
vcTextSize | The size of the text in EditText |
vcTextColor | The text color of EditText |
vcTextCursorDrawable | The cursor Drawable for EditText |
vcGravity | The EditText Gravity |
vcInputType | The input type of EditText |
Use advanced
With the VerCodeLayout control, VerCodeEditText inherits from VerCodeLayout. VerCodeLayout comes with the ability to select the next one when an EditText is typed or deleted, but the EditText must set maxLength.
<! - the plate - > < com. Simple. Vclayout. VerCodeLayout android: layout_width = "wrap_content" android: layout_height = > "wrap_content" <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="@drawable/sr_et_bg_accent" android:gravity="center" android:inputType="text" android:maxLength="1" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="@drawable/sr_et_bg_accent" android:gravity="center" android:inputType="text" android:maxLength="1" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="@drawable/sr_et_bg_accent" android:gravity="center" android:inputType="number" android:maxLength="1" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="@drawable/sr_et_bg_accent" android:gravity="center" android:inputType="number" android:maxLength="1" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="@drawable/sr_et_bg_accent" android:gravity="center" android:inputType="number" android:maxLength="1" /> </com.simple.vclayout.VerCodeLayout>Copy the code
Available methods
The method name | Methods effect |
---|---|
setOnCompleteListener | Listen for input completion |
clear | Clear all input |
getEditTexts | Get all editTexts |
Version update
- 1.0.0 First Upload