33

If I have a ListView with two different kinds of items, enabled and disabled ones (meaning selectable and non-selectable), Android draws a small divider correctly between the enabled items, but not between disabled items. Instead it draws a transparent divider, which causes really bad design issues. This has already been discussed here (Google Groups), but without any solution.

What I'm looking for is a way to force Android to draw the same divider which is being used between enabled items also to being used between disabled items instead of just leaving a transparent space.

znq
  • 44,613
  • 41
  • 116
  • 144
  • I've run into this problem as well and it saddens me that that is supposed to be the expected behavior. The only solution I can think of is to draw the dividers yourself by creating your own adapter that automatically adds them where appropriate. – Dan Lew Dec 09 '09 at 17:16
  • I've been looking around for a while now and haven't found a proper solution as well. Will update this post as soon as I find one. For now I also use the custom adapter as a workaround. – znq Dec 14 '09 at 14:28
  • I just encounter the same problem in my app. A non selectable headerView does not display the divider (header added with this method! addHeaderView (View v, Object data, boolean isSelectable). I will put it directly in my header... – ol_v_er Nov 08 '11 at 14:26

2 Answers2

1

if you have headers and/or footers this: http://java.dzone.com/articles/android-listview-%E2%80%93-fixing is the correct answer. Really nicely explained.

Denny1989
  • 639
  • 1
  • 9
  • 15
  • His approach sort of works but it's slightly problematic. If `areAllItemsEnabled()` returns true, you can bring any item into focus and click it, including items for which `isEnabled` would return false. Try using arrow keys + enter in an emulator. – Daniel Lubarov May 11 '15 at 20:28
  • if you disable/ clickable false the content itself it should not click through to the list. the isEnabled feature of listview can't be used in an appropriate way imho as there are many bugs / incompatibilities like this one – Denny1989 May 22 '15 at 09:01
0

yes is not cool at all! I ran into the same issue. The way to fix it is add a View type line into your xml file and set your divider to 0 height like so: android:dividerHeight="0dp" Note: this is on list view itself.

dropsOfJupiter
  • 6,763
  • 12
  • 47
  • 59