现在的位置: 首页 > 综合 > 正文

android 圆角编辑框

2013年09月03日 ⁄ 综合 ⁄ 共 1547字 ⁄ 字号 评论关闭

 

main.xml:

 

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:orientation="vertical"  
  4.     android:layout_width="fill_parent"  
  5.     android:layout_height="fill_parent"  
  6.     >  
  7.     <TextView    
  8.         android:layout_width="fill_parent"   
  9.         android:layout_height="wrap_content"  
  10.         android:gravity="center_horizontal"   
  11.         android:text="圆角编辑框"  
  12.     />  
  13.     <LinearLayout  
  14.         android:layout_width="fill_parent"  
  15.         android:layout_height="wrap_content"  
  16.         android:gravity="center_horizontal"  
  17.         android:orientation="horizontal">  
  18.           
  19.         <EditText  
  20.             android:layout_width="220px"  
  21.             android:layout_height="wrap_content"  
  22.             android:padding="5px"  
  23.             android:background="@drawable/rounded_edittext_states"   
  24.             android:drawableLeft="@drawable/search"  
  25.             android:singleLine="true"  
  26.             android:lines="1"  
  27.         />  
  28.           
  29.         <Button  
  30.             android:layout_width="wrap_content"  
  31.             android:layout_height="wrap_content"  
  32.             android:background="@drawable/button_search_bg"  
  33.         />   
  34.     </LinearLayout>  
  35. </LinearLayout>  

 

 

rounded_edittext_states.xml  :

  1. <?xml version="1.0" encoding="utf-8"?>   
  2. <!-- res/drawable-hdpi/rounded_edittext_states.xml -->   
  3. <selector xmlns:android="http://schemas.android.com/apk/res/android">   
  4.     <item    
  5.         android:state_pressed="true"    
  6.         android:state_enabled="true"   

抱歉!评论已关闭.