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
<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>
