Add padding to height of AutoCompleteTextView drop-down.
As described in http://b/issue?id=2017825
PopupWindow.getMaxAvailableHeight() does not include the padding in
the available height. To get the ACTV drop-down to actually fill
the screen, this change adds the padding to the value returned
by PopupWindow.getMaxAvailableHeight().
This is part of the fix for http://b/issue?id=2014450
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index a998072..456f8ed 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -104,6 +104,7 @@
private View mDropDownAnchorView; // view is retrieved lazily from id once needed
private int mDropDownWidth;
private int mDropDownHeight;
+ private final Rect mTempRect = new Rect();
private Drawable mDropDownListHighlight;
@@ -1323,7 +1324,15 @@
getDropDownAnchorView(), mDropDownVerticalOffset, ignoreBottomDecorations);
if (mDropDownAlwaysVisible) {
- return maxHeight;
+ // getMaxAvailableHeight() subtracts the padding, so we put it back,
+ // to get the available height for the whole window
+ int padding = 0;
+ Drawable background = mPopup.getBackground();
+ if (background != null) {
+ background.getPadding(mTempRect);
+ padding = mTempRect.top + mTempRect.bottom;
+ }
+ return maxHeight + padding;
}
return mDropDownList.measureHeightOfChildren(MeasureSpec.UNSPECIFIED,