From e4e7f6c907231ab70337f1fec3a695cdb6cbfc02 Mon Sep 17 00:00:00 2001 From: leinad87 Date: Wed, 24 Apr 2013 21:08:09 +0300 Subject: [PATCH] Adjust the size of each child When the children use images, these images has the same width as HorizontalListView and AdjustViewBounds doesn't work. See example: http://stackoverflow.com/questions/16134760/horizontallistview-custom-image-text-view Changing getWidth() and getHeight() with params.width or params.height solves. --- .../src/com/devsmart/android/ui/HorizontalListView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devsmartlib/src/com/devsmart/android/ui/HorizontalListView.java b/devsmartlib/src/com/devsmart/android/ui/HorizontalListView.java index 076ed38..23b4f62 100644 --- a/devsmartlib/src/com/devsmart/android/ui/HorizontalListView.java +++ b/devsmartlib/src/com/devsmart/android/ui/HorizontalListView.java @@ -151,8 +151,8 @@ private void addAndMeasureChild(final View child, int viewPos) { } addViewInLayout(child, viewPos, params, true); - child.measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST), - MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST)); + child.measure(MeasureSpec.makeMeasureSpec(params.width, MeasureSpec.AT_MOST), + MeasureSpec.makeMeasureSpec(params.height, MeasureSpec.AT_MOST)); }