title: Android popupmenu position
body: <p>I am trying make an android app where clicking a button raises a <code>popupmenu</code>. The <code>popupmenu</code> is being generated but not at the correct position. The code is as follows:</p>
  
  <p><em>menu.xml</em></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;group android:checkableBehavior="single"&gt;
  &lt;item
      android:id="@+id/genderMale"
      android:title="Male"
  /&gt;
  &lt;item
      android:id="@+id/genderFemale"
      android:title="Female"
  /&gt;
  &lt;/group&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>The function to execute the popup is as follows:</p>
  
  <pre><code>public void showGenderPopup(View v)
  {
      PopupMenu popup = new PopupMenu(this, v);
      MenuInflater inflater = popup.getMenuInflater();
      inflater.inflate(R.menu.gender_popup, popup.getMenu());
      popup.show();
  }
  </code></pre>
  
  <p>Here the <code>popupmenu</code> is being created just below the <code>textview</code> when I am clicking it. I want it to be generated at the centre of the screen.</p>
  
  <p>How to go about it?</p>