title: Android - Is it possible to change the gravity of a custom dialog?
body: <p>The image below is essentially what I want to achieve, this comes straight out of eclipse as my dialog_layout.xml</p>
  
  <p>I want to inflate a custom dialog and have it on the right of screen to serve as a menu. Everytime, I try to show this <code>DialogFragment</code>, the layout below centres itself to the centre of the screen. (The code for the <code>onCreateDialog()</code> of the `DialogFragment1 is below the image.</p>
  
  <p>Is there any way to achieve this? Do I have to create an Activity using a dialog theme?</p>
  
  <p><img src="https://i.stack.imgur.com/rpAoj.png" alt="Desired dialog"></p>
  
  <pre><code>@Override
  public Dialog onCreateDialog(Bundle savedInstanceState)
  {
      // Create a new Dialog using the AlertDialog Builder
      AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  
      View background = getActivity().getLayoutInflater().inflate(R.layout.dialog_layout, null);
  
      builder.setView(background);        
  
      return builder.create();
  }
  </code></pre>
  
  <p>Any help would be appreciated!</p>
  
  <p>Cheers</p>