How to add dividers between disabled items in ListView? - Lollipop
Asked Answered
W

1

6

To add the dividers between disabled items (not clickable) in ListView for Android previous to Lollipop I override adapter's method areAllItemsEnabled() to return true. But now in Lollipop this method doesn't fix the problem. The dividers are invisible in ExpandableListView too.

Is there a way to fix this problem without adding the divider in my item layout?

Wilds answered 6/12, 2014 at 9:30 Comment(1)
This featured is not added in Lollipop library.Vanbuskirk
A
2

We ended up adding two Views of 1dp to fake the divider and checking on version to set Visibility. The problem is worse. We also needed to keep track of if the next row is enabled or not, if it is the last row. A lot of cheese on an already deficient ListView (as compared to UITableView for example).

if(isItemAvailable(item) || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    rowView = inflater.inflate(R.layout.size_row, parent, false);
} else {
    rowView = inflater.inflate(R.layout.size_row_with_divider, parent, false);
}
Alguire answered 16/4, 2015 at 17:24 Comment(1)
i hope its not too late i found this solution here #26877404 hope it helps you.Pangolin

© 2022 - 2024 — McMap. All rights reserved.