Fixing handling of top/bottom margins in InterpolatingLayout
Change-Id: Ib023021f31c4a813fe7bf976b42f1101da91ce9a
diff --git a/res/layout-xlarge/contact_browser.xml b/res/layout-xlarge/contact_browser.xml
index 4e20171..53177ce 100644
--- a/res/layout-xlarge/contact_browser.xml
+++ b/res/layout-xlarge/contact_browser.xml
@@ -45,8 +45,9 @@
<FrameLayout
android:id="@+id/list_container"
- android:layout_height="match_parent"
+ android:layout_height="0dip"
android:layout_width="match_parent"
+ android:layout_weight="1"
android:background="@drawable/list_background_holo" />
</LinearLayout>
diff --git a/src/com/android/contacts/widget/InterpolatingLayout.java b/src/com/android/contacts/widget/InterpolatingLayout.java
index fb0c371..63fc2f6 100644
--- a/src/com/android/contacts/widget/InterpolatingLayout.java
+++ b/src/com/android/contacts/widget/InterpolatingLayout.java
@@ -244,7 +244,8 @@
break;
case LayoutParams.MATCH_PARENT:
childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(
- parentHeight, MeasureSpec.EXACTLY);
+ parentHeight - params.topMargin - params.bottomMargin,
+ MeasureSpec.EXACTLY);
break;
default:
childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(
@@ -304,7 +305,8 @@
right - left - offset - rightMargin,
bottom - top - params.bottomMargin);
- Gravity.apply(gravity, child.getMeasuredWidth(), child.getMeasuredHeight(),
+ int height = Math.max(child.getMeasuredHeight(), mInRect.height());
+ Gravity.apply(gravity, child.getMeasuredWidth(), height,
mInRect, mOutRect);
child.layout(mOutRect.left, mOutRect.top, mOutRect.right, mOutRect.bottom);