title: Why does my layout cause my app to crash?
body: <p>And what are the rules I need to keep in order to avoid a layout crash?</p>
  
  <p>For example, I have this layout with just 4 Buttons and 4 TextView.
  I really don't know why it causes crash on some devices and on other devices it works ok.</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
      &lt;Button
          android:id="@+id/ConnectButton"
          android:layout_width="300dp"
          android:layout_height="70dp"
          android:layout_gravity="center"
          android:gravity="center"
          android:text="@string/Connect" &gt;
      &lt;/Button&gt;
  
      &lt;Button
          android:id="@+id/DisconnectButton"
          android:layout_width="300dp"
          android:layout_height="70dp"
          android:layout_gravity="center"
          android:gravity="center"
          android:text="@string/Disconnect" &gt;
      &lt;/Button&gt;
  
      &lt;Button
          android:id="@+id/NoAlertButton"
          android:layout_width="120dp"
          android:layout_height="50dp"
          android:layout_gravity="center"
          android:gravity="center"
          android:text="@string/NoAlert" &gt;
      &lt;/Button&gt;
  
      &lt;Button
          android:id="@+id/MildAlertButton"
          android:layout_width="120dp"
          android:layout_height="50dp"
          android:layout_gravity="center"
          android:gravity="center"
          android:text="@string/MildAlert" &gt;
      &lt;/Button&gt;
  
      &lt;Button
          android:id="@+id/HighAlertButton"
          android:layout_width="120dp"
          android:layout_height="50dp"
          android:layout_gravity="center"
          android:gravity="center"
          android:text="@string/HighAlert" &gt;
      &lt;/Button&gt;
  
      &lt;TextView
          android:id="@+id/AlertLevelSelectionLabel"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="@string/SelectAlertLevel" &gt;
      &lt;/TextView&gt;
  
      &lt;TextView
          android:id="@+id/CurrentRSSILevelLabel"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="@string/CurrentRSSILevel" &gt;
      &lt;/TextView&gt;
  
      &lt;TextView
          android:id="@+id/ConnectedToLabel"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="@string/ConnectToLabel" &gt;
      &lt;/TextView&gt;
  
      &lt;TextView
          android:id="@+id/ImmediateAlert"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:background="#ffff3333"
          android:text="@string/ImmediateAlert"
          android:textSize="42sp"
          android:textStyle="bold" &gt;
      &lt;/TextView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>The crash appears only after clicking the button, so it may be related to the TextViews that appear after them, but I don't know why the TextViews cause the layout crash.
  I assume it is a layout issue since the horizontal layout of the same application works OK.</p>