Android ListView及其属性

写的不错:

  http://www.cnblogs.com/allin/archive/2010/05/11/1732200.html

Android-ListView几个比较特别的属性

1)android:stackFromBottom="true" 
设置你做好的列表显示在列表的最下面,值为true和false. 

2)android:transcriptMode="alwaysScroll"  
设置的控件transcriptMode属性可以将Android平台的控件(支持ScrollBar)自动滑动到最底部. 

3)android:cacheColorHint 
如果只是换背景的颜色的话,可以直接指定android:cacheColorHint为你所要的颜色,如果你是用图片做背景的话,那也只要将android:cacheColorHint指定为透明(#00000000)就可以了. 

4)android:divider="@drawable/list_driver" 
设置显示分割线图形,如果不想显示分割线则只要设置为android:divider="@drawable/@null" 就可以了,分割线可以自定义颜色、或图片.android:dividerHeight="6px"设置分割线高度像素. 

5)android:scrollbars="none" 
与setVerticalScrollBarEnabled(true);的效果一样,不活动的时候隐藏,活动的时候也隐藏. 

6)android:fadeScrollbars="true"  
配置ListView布局的时候,设置这个属性为true就可以实现滚动条的自动隐藏和显示. 

7)android:fadingEdge="none" 
设置上边和下边是否有黑色的阴影. 

    1. <?xml version="1.0" encoding="utf-8" ?>      
    2.     
    3. <selector xmlns:android="http://schemas.android.com/apk/res/android">      
    4.     
    5. <!-- 没有焦点时的背景图片 -->      
    6.     
    7. <item android:state_window_focused="false"        
    8. android:drawable="@drawable/pic1" />        
    9. <!-- 非触摸模式下获得焦点并单击时的背景图片 -->      
    10.     
    11. <item android:state_focused="true" android:state_pressed="true"        
    12. android:drawable= "@drawable/pic2" />        
    13. <!-- 触摸模式下单击时的背景图片 -->      
    14.     
    15. <item android:state_focused="false" android:state_pressed="true"        
    16. android:drawable="@drawable/pic3" />        
    17. <!--选中时的图片背景 -->      
    18.     
    19. <item android:state_selected="true"        
    20. android:drawable="@drawable/pic4" />        
    21. <!--获得焦点时的图片背景 -->      
    22.     
    23. <item android:state_focused="true"        
    24. android:drawable="@drawable/pic5" />        
    25. </selector>      
原文地址:https://www.cnblogs.com/lotusve/p/2395715.html