2012-08-03 55 views
22

目前我使用這個代碼看分隔線:ListView分隔線的默認顏色是什麼?

medalsList.setDivider(new ColorDrawable(0x99F10529)); 
medalsList.setDividerHeight(1); 

什麼是尚未有它的分隔線一個ListView使用的默認RGB顏色(如上面的代碼所示)改變了嗎?

回答

36

默認分隔線由當前主題中的listDivider項目確定。對於股票的主題,默認的分隔符是一個:

  • 機器人:可繪製/ divider_horizo​​ntal_dark(主題)
  • 機器人:可繪製/ divider_horizo​​ntal_bright(Theme.Light)
  • 機器人:可繪製/ divider_horizo​​ntal_holo_dark(主題。霍洛)
  • 機器人:可繪製/ divider_horizo​​ntal_holo_light(Theme.Holo.Light)

那些可繪製可以在SDK安裝的平臺上的數據文件夾中找到。

+0

非常感謝你 – 2016-07-04 13:52:13

18

您可以使用:

<View 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="?android:attr/listDivider" /> 

參見:How can I get the default divider?

附:在這裏發佈,因爲谷歌搜索似乎首先在這個線程而不是另一個。

相關問題