main.xml
[java] view
plaincopy
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg"
android:orientation="vertical" >
<EditText
android:id="@+id/et"
android:layout_width="251dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableLeft="@drawable/title"
android:background="@drawable/shape"
android:padding="10px"
android:hint="北京"
android:singleLine="true"
android:textColor="#FFFAFA"/>
</LinearLayout>
在drawable中建一个xml文件:shape.xml
[java] view
plaincopy
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#00ff00ff"/>
<corners android:radius="8px"/>
<stroke android:color="#32CD32"
android:width="2px"
/>
</shape>
转自:http://blog.csdn.net/jdsjlzx/article/details/31401205