I have a simple PopupWindow
that I create with the following code (the code is in C#, the Java code should be basically the same)
View popupView = LayoutInflater.From(this.Activity).Inflate(Resource.Layout.LectionFooter, null);
var popup = new PopupWindow(popupView, ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.WrapContent, false)
{
OutsideTouchable = true,
AnimationStyle = Resource.Style.FooterAnimation
};
popup.SetBackgroundDrawable(new BitmapDrawable());
popup.ShowAtLocation(rootView, GravityFlags.Bottom, 0, 0);
On pre-Lollipop devices, this popup looks fine, but on Android 5.0, the popup overlaps the soft buttons:
Here's the PopupWindow
on an Android 4.4 device:
Does anyone have an idea why this happens and how this can be fixed?
This is possible bug in android api 21 that's why they introduced popup.setAttachedInDecor(true/false); method in api 22
however there is a workout, you can set right y
coordinate for your popup as follows:
Rect rect = new Rect();
getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
int winHeight = getWindow().getDecorView().getHeight();
popup.showAtLocation(rootView, Gravity.BOTTOM, 0, winHeight-rect.bottom);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With