title: Android AlertDialog custom layout distortion
body: <p>Hi I'm wondering about how exactly alertdialogs inflate custom xml layouts? In my example, the xml looks fine when I look at it in the eclipse editor however when the alertdialog builds it i looks completly different. (Sadly I do'nt have the reputation to post screenshots)</p>
  
  <p>Heres the xml. The layout gets pushed up so to speak, so the bottom half of linearlayouts take up maybe 2 thirds of the page even though they have a weight of only 0.40 (ps if anyone could tell me an alternative to all these linearlayouts I would be gratefull!!)
  Thank You</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/layout_root"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical"
   &gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="0.20"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="0.98"
          android:orientation="vertical" &gt;
  
          &lt;TextView
              android:id="@+id/textView1"
              android:layout_width="wrap_content"
              android:layout_height="match_parent"
              android:layout_gravity="center_vertical"
              android:paddingLeft="20dp"
              android:paddingTop="32dp"
              android:text="Share with..."
              android:textAppearance="?android:attr/textAppearanceLarge"
              android:textColor="#00C5CD" &gt;
          &lt;/TextView&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="0.02"
          android:orientation="vertical" &gt;
  
          &lt;View
              android:layout_width="fill_parent"
              android:layout_height="1dip"
              android:background="#00C5CD" &gt;
          &lt;/View&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="0.40"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="0.50"
          android:orientation="horizontal" &gt;
  
          &lt;LinearLayout
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_gravity="center"
              android:layout_weight="0.50"
              android:orientation="vertical" &gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  android:layout_gravity="center"
                  android:layout_weight="0.350"
                  android:orientation="vertical" &gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  android:layout_gravity="center"
                  android:layout_weight="0.350"
                  android:orientation="vertical" &gt;
  
                  &lt;ImageView
                      android:id="@+id/iv_prev"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:src="@drawable/facebook" /&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  android:layout_gravity="center"
                  android:layout_weight="0.150"
                  android:orientation="vertical" &gt;
  
                  &lt;TextView
                      android:id="@+id/tv_customize_pill"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:paddingTop="10dp"
                      android:text="Whatsapp"
                      android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  android:layout_gravity="center"
                  android:layout_weight="0.150"
                  android:orientation="vertical" &gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_gravity="center"
              android:layout_weight="0.50"
              android:orientation="vertical" &gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  android:layout_gravity="center"
                  android:layout_weight="0.350"
                  android:orientation="vertical" &gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  android:layout_gravity="center"
                  android:layout_weight="0.350"
                  android:orientation="vertical" &gt;
  
                  &lt;ImageView
                      android:id="@+id/iv_preview3"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:src="@drawable/whatsapp" /&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  android:layout_gravity="center"
                  android:layout_weight="0.150"
                  android:orientation="vertical" &gt;
  
                  &lt;TextView
                      android:id="@+id/tv_customize_pillsas"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:paddingTop="10dp"
                      android:text="Whatsapp"
                      android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  android:layout_gravity="center"
                  android:layout_weight="0.150"
                  android:orientation="vertical" &gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="0.40"
      android:orientation="horizontal" &gt;
  
      &lt;LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_gravity="center"
          android:layout_weight="0.50"
          android:orientation="vertical" &gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_gravity="center"
              android:layout_weight="0.150"
              android:orientation="vertical" &gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_gravity="center"
              android:layout_weight="0.350"
              android:orientation="vertical" &gt;
  
              &lt;ImageView
                  android:id="@+id/iv_preview4"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:src="@drawable/email" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_gravity="center"
              android:layout_weight="0.150"
              android:orientation="vertical" &gt;
  
              &lt;TextView
                  android:id="@+id/tv_customize_pill4"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:paddingTop="10dp"
                  android:text="Email"
                  android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_gravity="center"
              android:layout_weight="0.350"
              android:orientation="vertical" &gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="0.50"
          android:orientation="vertical" &gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>