PopupWindow - not working on a few devices
I got the same problem on a Nexus 7 (not 2012) running the 5.1.1. It is finally fixed by adding this line:
popupWindow.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
I was having the same problem: my PopupWindow
was not showing on my 5.1.1 android device but it was on others. I realised that I had to specify the width
and height
in order to be shown on that version (which is still compatible with the rest of the versions as well).
Here is an example:
popUp.setWidth(MATCH_PARENT);popUp.setHeight(WRAP_CONTENT);
In my case, popup window have no sizes on few devices.
Try that after setContentView
50000
- just a big size for measure.
popupWindow.getContentView().measure(50000, 50000); popupWindow.setWidth(popupWindow.getContentView().getMeasuredWidth()); popupWindow.setHeight(popupWindow.getContentView().getMeasuredHeight());
You can use screen size instead 50000