Home » Android » Android: ListView non-enabled items draw invisible divider

Android: ListView non-enabled items draw invisible divider

Posted by: admin April 23, 2020 Leave a comment

Questions:

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.

How to&Answers:

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.

Answer:

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.