What is the default color of a ListView divider line?
Asked Answered
F

2

31

Currently I am using this code to see the divider lines:

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

What is the default RGB color (as shown in the code above) used on a ListView that hasn't had its divider lines changed?

Fidge answered 3/8, 2012 at 1:58 Comment(0)
D
39

The default divider is determined by the listDivider item in the current theme. For the stock themes, the default divider is one of:

  • android:drawable/divider_horizontal_dark (Theme)
  • android:drawable/divider_horizontal_bright (Theme.Light)
  • android:drawable/divider_horizontal_holo_dark (Theme.Holo)
  • android:drawable/divider_horizontal_holo_light (Theme.Holo.Light)

Those drawables can be found in the platforms data folder of your sdk installation.

Dihybrid answered 3/8, 2012 at 2:10 Comment(0)
M
37

You can use:

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

Refer: How can I get the default divider?

P.S. Posting it here because Google search seems to land first on this thread instead of the other one.

Merwyn answered 8/11, 2015 at 18:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.