I'm a using a GridView and a PopupMenu for every item of the GridView. Unfortunately the popup appears below or over the item that is clicked. I would like it to appear on the center of the screen horizontally and vertically.
PopupMenu popupMenu = new PopupMenu(wrapper, v);
popupMenu.getMenuInflater().inflate(R.menu.item_gridview_menu, popupMenu.getMenu());
I have tried setting the gravity to center like this
PopupMenu popup = new PopupMenu(this, v,Gravity.CENTER);
but it just centers the popup over the item that is clicked. Also I have styled the popup with:
<style name="PopupMenu" parent="@android:style/Widget.PopupMenu">
<item name="android:popupBackground">@android:color/white</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:textColor">@color/white</item>
<item name="android:background">@color/colorPrimary</item>
</style>
but that didn't help either. Any ideas?