改写ListView样式

ava代码

  1.          android:id= "@id/android:list"   
  2.          android:layout_width= "fill_parent"   
  3.          android:layout_height= "fill_parent"   
  4.          android:drawSelectorOnTop= "true"   
  5.          android:listSelector= "@drawable/selector"   
  6.          android:divider= "@drawable/list_line" />  

selector:如下

Xml代码
  1. selector xmlns:android = "http://schemas.android.com/apk/res/android" >   
  2.   
  3. < item   
  4. android:drawable = "@drawable/list_normal"   
  5. android:state_selected = "false"   
  6. android:state_pressed = "false" />   
  7.   
  8. < item   
  9. android:drawable = "@drawable/list_pressed"   
  10. android:state_selected = "false"   
  11. android:state_pressed = "true" />   
  12.   
  13. < item   
  14. android:drawable = "@drawable/list_pressed"   
  15. android:state_selected = "true" />   
  16.   
  17. selector >    
selector xmlns:android="http://schemas.android.com/apk/res/android"> 

 

 

 

android:divider="@drawable/list_line" 就是每项之间的横线

可以找个横线图片

/************************************************************************/

你可能感兴趣的:(Android基础)