diff options
| author | Adam Powell <adamp@google.com> | 2011-02-16 16:49:50 -0800 |
|---|---|---|
| committer | Adam Powell <adamp@google.com> | 2011-02-16 16:55:45 -0800 |
| commit | 348e69cfabec21ccfbe708df06f0a7ea541a3053 (patch) | |
| tree | fc54d7b8550bfc38be9ecaa5529749d0653fbdb6 /core/java/android/widget/PopupWindow.java | |
| parent | 5a5b4ba9fe40605d5e43b7ff25a58f7174509a53 (diff) | |
Fix bug 3413800 - Revise AutoCompleteTextView dropdown behavior
Be more conservative with when we let an AutoCompleteTextView's
dropdown box of completion suggestions cover the IME.
Disable the expand-when-touched behavior of the dropdown list when
more than 3 items can be seen at a time without it.
Don't let a ListPopupWindow that is expanding in response to touch
scroll the anchor view within its parent and slide the dropdown out
from under the user's finger.
Change-Id: I009accfd4e841c9a5e1072735d8a0b067a0bc06a
Diffstat (limited to 'core/java/android/widget/PopupWindow.java')
| -rw-r--r-- | core/java/android/widget/PopupWindow.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java index 439e0cabe19f..53932af65404 100644 --- a/core/java/android/widget/PopupWindow.java +++ b/core/java/android/widget/PopupWindow.java @@ -90,6 +90,7 @@ public class PopupWindow { private int mSplitTouchEnabled = -1; private boolean mLayoutInScreen; private boolean mClipToScreen; + private boolean mAllowScrollingAnchorParent = true; private OnTouchListener mTouchInterceptor; @@ -592,6 +593,16 @@ public class PopupWindow { mClipToScreen = enabled; setClippingEnabled(!enabled); } + + /** + * Allow PopupWindow to scroll the anchor's parent to provide more room + * for the popup. Enabled by default. + * + * @param enabled True to scroll the anchor's parent when more room is desired by the popup. + */ + void setAllowScrollingAnchorParent(boolean enabled) { + mAllowScrollingAnchorParent = enabled; + } /** * <p>Indicates whether the popup window supports splitting touches.</p> @@ -1045,7 +1056,8 @@ public class PopupWindow { anchor.getWindowVisibleDisplayFrame(displayFrame); final View root = anchor.getRootView(); - if (p.y + mPopupHeight > displayFrame.bottom || p.x + mPopupWidth - root.getWidth() > 0) { + if (mAllowScrollingAnchorParent && (p.y + mPopupHeight > displayFrame.bottom || + p.x + mPopupWidth - root.getWidth() > 0)) { // if the drop down disappears at the bottom of the screen. we try to // scroll a parent scrollview or move the drop down back up on top of // the edit box |
