This section describes adding C1MaskedTextField controls to an Android application for specifying four input fields, namely ID, Date of Birth, Phone and State. The ID input field accepts a nine-digit number separated by hyphens, the Date of Birth field accepts a date in mm/dd/yyyy format, the Phone field accepts a 10-digit number with area code, and the State field accepts abbreviated postal code of a state.
The following image shows the input fields after completing the above steps.
Add the following code to initialize four input fields using C1MaskedTextField controls in you .axml file.
XML |
Copy Code |
---|---|
<?xml version="1.0" encoding="utf-8"?> <GridLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:columnCount="2" android:paddingBottom="20dp" android:paddingLeft="20dp" android:paddingRight="20dp" android:paddingTop="20dp" android:rowCount="4"> <C1.Android.Input.C1MaskedTextView android:id="@+id/idMask" android:layout_width="300dp" android:layout_height="wrap_content" app:c1_mask="999 99-0000" app:c1_promptChar="_" /> <C1.Android.Input.C1MaskedTextView android:id="@+id/dateMask" android:layout_width="300dp" android:layout_height="wrap_content" app:c1_mask="90/90/0000" app:c1_promptChar="_" /> <C1.Android.Input.C1MaskedTextView android:id="@+id/phoneMask" android:layout_width="300dp" android:layout_height="wrap_content" app:c1_mask="(999)000-0000" app:c1_promptChar="_" /> <C1.Android.Input.C1MaskedTextView android:id="@+id/stateMask" android:layout_width="300dp" android:layout_height="wrap_content" app:c1_mask="LL" app:c1_promptChar="_" /> </GridLayout> |