From dace7ff271c7e08131202f4395ebaea99b6844c1 Mon Sep 17 00:00:00 2001 From: Romain Guy <> Date: Tue, 24 Mar 2009 18:23:21 -0700 Subject: [PATCH] Automated import from //branches/master/...@140745,140745 --- core/java/android/widget/ListView.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index aced533192a3c..fd5556e8fac9f 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -2769,6 +2769,8 @@ public class ListView extends AbsListView { final boolean headerDividers = mHeaderDividersEnabled; final boolean footerDividers = mFooterDividersEnabled; final int first = mFirstPosition; + final boolean areAllItemsSelectable = mAreAllItemsSelectable; + final ListAdapter adapter = mAdapter; if (!mStackFromBottom) { int bottom; @@ -2779,7 +2781,10 @@ public class ListView extends AbsListView { (footerDividers || first + i < footerLimit)) { View child = getChildAt(i); bottom = child.getBottom(); - if (bottom < listBottom) { + // Don't draw dividers next to items that are not enabled + if (bottom < listBottom && (areAllItemsSelectable || + (adapter.isEnabled(first + i) && (i == count - 1 || + adapter.isEnabled(first + i + 1))))) { bounds.top = bottom; bounds.bottom = bottom + dividerHeight; drawDivider(canvas, bounds, i); @@ -2795,7 +2800,10 @@ public class ListView extends AbsListView { (footerDividers || first + i < footerLimit)) { View child = getChildAt(i); top = child.getTop(); - if (top > listTop) { + // Don't draw dividers next to items that are not enabled + if (top > listTop && (areAllItemsSelectable || + (adapter.isEnabled(first + i) && (i == count - 1 || + adapter.isEnabled(first + i + 1))))) { bounds.top = top - dividerHeight; bounds.bottom = top; // Give the method the child ABOVE the divider, so we