ListView分隔线的默认颜色是什么?

时间:2012-08-03 01:58:05

标签: android android-listview

目前我正在使用此代码查看分隔线:

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

在没有更改分隔线的ListView上使用的默认RGB颜色(如上面的代码所示)是什么?

2 个答案:

答案 0 :(得分:37)

默认分隔符由当前主题中的listDivider项确定。对于股票主题,默认分隔符是以下之一:

  • android:drawable / divider_horizo​​ntal_dark(主题)
  • android:drawable / divider_horizo​​ntal_bright(Theme.Light)
  • android:drawable / divider_horizo​​ntal_holo_dark(Theme.Holo)
  • android:drawable / divider_horizo​​ntal_holo_light(Theme.Holo.Light)

可以在sdk安装的平台数据文件夹中找到这些drawable。

答案 1 :(得分:23)

您可以使用:

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

参考:How can I get the default divider?

P.S。在此发布,因为Google搜索似乎首先登陆此主题,而不是另一个。

相关问题