PopupWindow: Gravity fixes. am: 085160612d
am: a732ea6c1f
Change-Id: Ide4ccd6cbfef913392a46b89486de064e0196ad6
This commit is contained in:
@@ -193,6 +193,8 @@ public class PopupWindow {
|
|||||||
|
|
||||||
private int mAnimationStyle = ANIMATION_STYLE_DEFAULT;
|
private int mAnimationStyle = ANIMATION_STYLE_DEFAULT;
|
||||||
|
|
||||||
|
private int mGravity = Gravity.NO_GRAVITY;
|
||||||
|
|
||||||
private static final int[] ABOVE_ANCHOR_STATE_SET = new int[] {
|
private static final int[] ABOVE_ANCHOR_STATE_SET = new int[] {
|
||||||
com.android.internal.R.attr.state_above_anchor
|
com.android.internal.R.attr.state_above_anchor
|
||||||
};
|
};
|
||||||
@@ -1141,15 +1143,11 @@ public class PopupWindow {
|
|||||||
|
|
||||||
mIsShowing = true;
|
mIsShowing = true;
|
||||||
mIsDropdown = false;
|
mIsDropdown = false;
|
||||||
|
mGravity = gravity;
|
||||||
|
|
||||||
final WindowManager.LayoutParams p = createPopupLayoutParams(token);
|
final WindowManager.LayoutParams p = createPopupLayoutParams(token);
|
||||||
preparePopup(p);
|
preparePopup(p);
|
||||||
|
|
||||||
// Only override the default if some gravity was specified.
|
|
||||||
if (gravity != Gravity.NO_GRAVITY) {
|
|
||||||
p.gravity = gravity;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.x = x;
|
p.x = x;
|
||||||
p.y = y;
|
p.y = y;
|
||||||
|
|
||||||
@@ -1394,8 +1392,8 @@ public class PopupWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int computeGravity() {
|
private int computeGravity() {
|
||||||
int gravity = Gravity.START | Gravity.TOP;
|
int gravity = mGravity == Gravity.NO_GRAVITY ? Gravity.START | Gravity.TOP : mGravity;
|
||||||
if (mClipToScreen || mClippingEnabled) {
|
if (mIsDropdown && (mClipToScreen || mClippingEnabled)) {
|
||||||
gravity |= Gravity.DISPLAY_CLIP_VERTICAL;
|
gravity |= Gravity.DISPLAY_CLIP_VERTICAL;
|
||||||
}
|
}
|
||||||
return gravity;
|
return gravity;
|
||||||
|
|||||||
Reference in New Issue
Block a user