android 中 EditText加入圖標 更改邊框顏色 設置透明

 main.xml

[java] view plaincopy
  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:background="@drawable/bg"  
  6.     android:orientation="vertical" >  
  7.   
  8.   
  9.     <EditText  
  10.         android:id="@+id/et"  
  11.         android:layout_width="251dp"  
  12.         android:layout_height="wrap_content"  
  13.         android:layout_gravity="center"   
  14.         android:drawableLeft="@drawable/title"  
  15.         android:background="@drawable/shape"  
  16.         android:padding="10px"  
  17.         android:hint="北京"  
  18.         android:singleLine="true"  
  19.         android:textColor="#FFFAFA"/>  
  20.   
  21. </LinearLayout>  

在drawable中建一個xml文件:shape.xml


[java] view plaincopy
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android">  
  3.     <solid android:color="#00ff00ff"/>  
  4.     <corners android:radius="8px"/>  
  5.     <stroke android:color="#32CD32"  
  6.         android:width="2px"  
  7.         />  
  8. </shape>  



轉自:http://blog.csdn.net/jdsjlzx/article/details/31401205

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章