自定义Android editText

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

 shape.xml 代码如下

<?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/liushengmeng/article/details/8121394

相关推荐