对应若水老师的第五课
一,设置一个输入框
添加控件:
<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>
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/sac761/article/details/47334921