diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIListView.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIListView.java index 4724f57f9b3..152b2568a83 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIListView.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIListView.java @@ -8,6 +8,7 @@ import android.content.Context; import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.view.View; import android.view.ViewGroup; @@ -214,7 +215,9 @@ private void processProperty(String name, Object value) ? TiConvert.toTiDimension(heightString, TiDimension.TYPE_HEIGHT) .getAsPixels((View) getNativeView().getParent()) : 0; - if (name.equals(TiC.PROPERTY_SEPARATOR_COLOR) + if (height == 0) { + this.listView.setSeparator(0, height); + } else if (name.equals(TiC.PROPERTY_SEPARATOR_COLOR) || properties.containsKey(TiC.PROPERTY_SEPARATOR_COLOR)) { String colorString = properties.getString(TiC.PROPERTY_SEPARATOR_COLOR); if (name.equals(TiC.PROPERTY_SEPARATOR_COLOR)) { @@ -227,10 +230,12 @@ private void processProperty(String name, Object value) } else { final TypedArray divider = context.obtainStyledAttributes(new int[] { android.R.attr.listDivider }); - final GradientDrawable defaultDrawable = (GradientDrawable) divider.getDrawable(0); + final Drawable defaultDrawable = divider.getDrawable(0); // Set platform default separator. - defaultDrawable.setSize(0, height); + if (defaultDrawable instanceof GradientDrawable) { + ((GradientDrawable) defaultDrawable).setSize(0, height); + } this.listView.setSeparator(defaultDrawable); divider.recycle(); } diff --git a/apidoc/Titanium/UI/ListView.yml b/apidoc/Titanium/UI/ListView.yml index b88118d1cd0..900755cb0cd 100644 --- a/apidoc/Titanium/UI/ListView.yml +++ b/apidoc/Titanium/UI/ListView.yml @@ -758,6 +758,8 @@ properties: description: | Height of the ListView separator, in platform-specific units. If undefined, default native height will be used. Numerical inputs are treated as pixels. For example, 3 and "3px" are equivalent. + On Android API < 23 you must specify and + for this property to work. type: [String, Number] since: "4.1.0" platforms: [android] @@ -1367,8 +1369,8 @@ examples: {properties: { title: 'Carrots'}}, {properties: { title: 'Potatoes'}}, ]; - sections.push(vegSection); var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables', items: vegDataSet}); + sections.push(vegSection); listView.sections = sections; win.add(listView);