一,设置一个输入框
添加控件:
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="52dp" <!--本控件顶部距离上一个控件的距离-->
/>
二,消除输入框的聚焦
方法一:
<EditText
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="52dp"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="52dp"
/>
方法二:
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="52dp"
>
<requestFocus />
三,限制输入内容与长度
android:maxLength="3"
android:inputType="number"
四,设置提示信息
android:hint="输入三个数字"
五,在输入框中加入图片
在drawable-mdpi放入图片tubiao.jpg
android:drawableLeft="@drawable/tubiao"
六,将输入框变圆角
在drawable-mdpi中建立文件shape.xml,内容为:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="#e2e2e2" >
</solid>
<corners
android:radius="7dp" <!--设置弧度-->
android:topLeftRadius="5dp"
android:topRightRadius="5dp" >
</corners>
</shape>