Recently looking at Lao Luo's Android video, learn to do a few small examples the following code is an example of using EditText to enter a specific character, here only the XML file:
<edittext
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "android:digits attribute number"/>
<edittext
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_margin= "10DP"
android:digits= "0123456789"/>
<textview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "android:digits attribute letter"/>
<edittext
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_margin= "10DP"
android:digits= "Qwertyuioplkjhgfdsazxcvbnm"/>
<textview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "Android:inputtype attribute number"/>
<edittext
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_margin= "10DP"
Android:inputtype= "Number|textcapcharacters"/>
<textview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "android:inputtype attribute Email"/>
<edittext
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_margin= "10DP"
Android:inputtype= "Textemailaddress"/>
<textview
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "Android:inputtype attribute Numberic"/>
<edittext
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_margin= "10DP"
android:numeric= "decimal|signed"/>
Note: The Digits property here restricts the input of only restricted characters, while InputType is the type that helps us to enter
EditText Android Learning ———— Android Control