«

android 中 EditText加入图标 更改边框颜色 设置透明

时间:2024-3-2 19:34     作者:韩俊     分类: Android


main.xml

[java] view
plaincopy

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android&quot;
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg"
android:orientation="vertical" >

&lt;EditText  
    android:id=&quot;@&#43;id/et&quot;  
    android:layout_width=&quot;251dp&quot;  
    android:layout_height=&quot;wrap_content&quot;  
    android:layout_gravity=&quot;center&quot;   
    android:drawableLeft=&quot;@drawable/title&quot;  
    android:background=&quot;@drawable/shape&quot;  
    android:padding=&quot;10px&quot;  
    android:hint=&quot;北京&quot;  
    android:singleLine=&quot;true&quot;  
    android:textColor=&quot;#FFFAFA&quot;/&gt;  

</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&quot;&gt;
<solid android:color="#00ff00ff"/>
<corners android:radius="8px"/>
<stroke android:color="#32CD32"
android:width="2px"
/>
</shape>





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

标签: android

热门推荐