2.1设置成0dp无效,2.1以上版本可以,如果无效的话那就只能设成1dp了。
2.设置引用
android:background="@drawable/shape"
EditText 其它属性
android:hint="请输入用户名" <!-- 设置提示文本 -->
android:drawableLeft="@drawable/ic_launcher" <!-- 设置文本框左边小图标 -->
例子:
1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="fill_parent"
4 android:layout_height="fill_parent"
5 android:orientation="vertical" >
6
7 <EditText
8 android:layout_width="fill_parent"
9 android:layout_height="wrap_content"
10 android:background="@drawable/shape"
11 android:drawableLeft="@drawable/ic_launcher"
12 android:drawablePadding="5dp"
13 android:hint="Hello Android"
14 android:padding="5dp" />
15
16 </LinearLayout>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="fill_parent"
4 android:layout_height="fill_parent"
5 android:orientation="vertical" >
6
7 <EditText
8 android:layout_width="fill_parent"
9 android:layout_height="wrap_content"
10 android:background="@drawable/shape"
11 android:drawableLeft="@drawable/ic_launcher"
12 android:drawablePadding="5dp"
13 android:hint="Hello Android"
14 android:padding="5dp" />
15
16 </LinearLayout>
