ListView的分割線屬性操作

ListView中每個Item項之間都有分割線,設置android:footerDividersEnabled表示是否顯示分割線,此屬性默認爲true。

1.不顯示分割線只要在ListView控件中添加android:footerDividersEnabled="false"即可。

[html] view plaincopy

  1. <ListView  
  2.     android:id="@+id/local_groups_list"  
  3.     android:layout_width="match_parent"  
  4.     android:layout_height="wrap_content"  
  5.     android:footerDividersEnabled="false" />  

2.改變ListView的分割線顏色和寬度,需要在佈局中定義android:divider和android:dividerHeight屬性。

 

[html] view plaincopy

  1. <ListView  
  2.     android:id="@+id/local_groups_list"  
  3.     android:layout_width="match_parent"  
  4.     android:layout_height="wrap_content"  
  5.     android:divider="@color/divider_color"  
  6.     android:dividerHeight="1px" />  

 

發佈了61 篇原創文章 · 獲贊 40 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章