android edittext中输入特定字符 inputtype digits
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="使用android:digits属性(输入数字)"></TextView>
<EditText android:id="@+id/num" android:layout_width="200dp"
android:layout_height="wrap_content" android:layout_margin="10dp"
android:digits="0123456789"></EditText>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="使用android:digits属性(输入26个小写字母)"></TextView>
<EditText android:layout_width="200dp" android:layout_height="wrap_content"
android:layout_margin="10dp" android:digits="qwertyuiopasdfghjklzxcvbnm"></EditText>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="使用android:inputType属性(输入数字)"></TextView>
<EditText android:layout_width="200dp" android:layout_height="wrap_content"
android:layout_margin="10dp" android:inputType="number|textCapCharacters"></EditText>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="使用android:inputType属性(输入Email)"></TextView>
<EditText android:layout_width="200dp" android:layout_height="wrap_content"
android:layout_margin="10dp" android:inputType="textEmailAddress"></EditText>
android:layout_height="wrap_content" android:text="使用android:digits属性(输入数字)"></TextView>
<EditText android:id="@+id/num" android:layout_width="200dp"
android:layout_height="wrap_content" android:layout_margin="10dp"
android:digits="0123456789"></EditText>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="使用android:digits属性(输入26个小写字母)"></TextView>
<EditText android:layout_width="200dp" android:layout_height="wrap_content"
android:layout_margin="10dp" android:digits="qwertyuiopasdfghjklzxcvbnm"></EditText>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="使用android:inputType属性(输入数字)"></TextView>
<EditText android:layout_width="200dp" android:layout_height="wrap_content"
android:layout_margin="10dp" android:inputType="number|textCapCharacters"></EditText>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="使用android:inputType属性(输入Email)"></TextView>
<EditText android:layout_width="200dp" android:layout_height="wrap_content"
android:layout_margin="10dp" android:inputType="textEmailAddress"></EditText>
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。