EditText
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="使用android:digits属性(输入数字)"
/>
<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:textColor="#000000"
android:background="#ffffff"
android:layout_margin="10dp"
android:digits="0123456789"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="使用android:numeric属性(输入有符号的浮点数)"
/>
<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:textColor="#000000"
android:background="#ffffff"
android:layout_margin="10dp"
android:numeric="decimal|signed"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="使用android:inputType属性(输入数字)"
/>
<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:textColor="#000000"
android:background="#ffffff"
android:layout_margin="10dp"
android:inputType="number"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="使用android:digits属性(输入26个小写字母)"
/>
<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:textColor="#000000"
android:background="#ffffff"
android:layout_margin="10dp"
android:digits="abcdefghijklmnopqrstuvwxyz"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="使用android:inputType属性(输入Email)"
/>
<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:textColor="#000"
android:background="#fff"
android:layout_margin="10dp"
android:inputType="textEmailAddress"
/>
</LinearLayout>
更多相关文章
- android自定义属性 format类型
- Android:configChanges 属性
- Android View类属性及方法
- Android中的visibility属性的区别
- Android引用资源(resources) vs 引用样式属性(style attribute)语法