title: How to center layout inside of Android Dialog?
body: <p>I am trying to create a custom Dialog, and have its content centered, but it is always ending up left-aligned.  Here is aboutdialog.xml:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout
    xmlns:a=&quot;http://schemas.android.com/apk/res/android&quot;
    a:orientation=&quot;vertical&quot;
    a:id=&quot;@+id/AboutDialogLayout&quot; 
    a:layout_width=&quot;fill_parent&quot; 
    a:layout_height=&quot;fill_parent&quot; 
    a:layout_gravity=&quot;center_horizontal&quot; 
    a:gravity=&quot;center_horizontal&quot;&gt;
  
      &lt;ImageView a:id=&quot;@+id/imageView1&quot; 
                 a:src=&quot;@drawable/pricebook&quot; 
                 a:layout_height=&quot;wrap_content&quot; 
                 a:layout_width=&quot;wrap_content&quot;/&gt;
      &lt;TextView a:layout_height=&quot;wrap_content&quot;         
                a:textAppearance=&quot;?android:attr/textAppearanceLarge&quot; 
                a:id=&quot;@+id/textView1&quot; 
                a:text=&quot;Price Book&quot; 
                a:layout_width=&quot;wrap_content&quot;/&gt;
      &lt;TextView a:layout_height=&quot;wrap_content&quot; 
                a:id=&quot;@+id/textView2&quot; 
                a:layout_width=&quot;wrap_content&quot; 
                a:text=&quot;foo&quot;/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>And my (relevant) code:</p>
  <pre><code>Dialog d = new Dialog(this);
  d.setContentView(R.layout.aboutdialog);
  d.setTitle(R.string.app_name);
  </code></pre>
  <p>What am I missing here?  Thanks for the assistance.</p>
  <p>Image:
  <img src="https://i.stack.imgur.com/09oxW.png" alt="Screen shot of Dialog problem" /></p>