title: Why are my TextViews being moved around?
body: <p>I am trying to display a single list item after the user clicks on an item. However, I have noticed that the layout is messed up when there is too much text. Sometimes it's pushed half way, sometimes it's completely to the right side of the screen. I don't understand why this is happening. How can I resolve this issue? Please note I have the exact same layout in a popup dialog with no problems.</p>
  
  <p>This is my XML code: </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content" &gt;
  
      &lt;TableLayout
          android:id="@+id/add_spot_layout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:shrinkColumns="1"
          android:stretchColumns="1" &gt;
  
          &lt;TableRow
              android:layout_marginBottom="1sp"
              android:layout_marginTop="2sp" &gt;
  
              &lt;TextView
                  android:id="@+id/nameDetails"
                  android:layout_width="fill_parent"
                  android:textSize="25sp"
                  android:textStyle="bold" /&gt;
          &lt;/TableRow&gt;
  
          &lt;!-- separator --&gt;
  
          &lt;View
              android:layout_width="fill_parent"
              android:layout_height="1dp"
              android:background="@android:color/darker_gray" /&gt;
  
          &lt;TableRow
              android:layout_marginBottom="2sp"
              android:layout_marginTop="2sp" &gt;
  
              &lt;TextView
                  android:layout_marginLeft="5sp"
                  android:text="@string/distance"
                   /&gt;
  
              &lt;TextView android:id="@+id/distanceDetails" /&gt;
          &lt;/TableRow&gt;
  
          &lt;TableRow
              android:layout_marginBottom="2sp"
              android:layout_marginTop="2sp" &gt;
  
              &lt;TextView
                  android:layout_marginLeft="5sp"
                  android:text="@string/address"
                   /&gt;
  
              &lt;TextView android:id="@+id/addrDetails" /&gt;
          &lt;/TableRow&gt;
  
          &lt;TableRow
              android:layout_marginBottom="2sp"
              android:layout_marginTop="2sp" &gt;
  
              &lt;TextView
                  android:layout_marginLeft="5sp"
                  android:text="@string/type"
                 /&gt;
  
              &lt;TextView android:id="@+id/typeDetails" /&gt;
          &lt;/TableRow&gt;
  
          &lt;TableRow
              android:layout_marginBottom="2sp"
              android:layout_marginTop="2sp" &gt;
  
              &lt;TextView
                  android:layout_marginLeft="5sp"
                  android:text="@string/terrain" /&gt;
  
              &lt;RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" &gt;
  
                  &lt;RatingBar
                      android:id="@+id/terrainDetails"
                      style="?android:attr/ratingBarStyleSmall"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:isIndicator="true"
                      android:max="5"
                      android:numStars="5"
                      android:stepSize="1" /&gt;
              &lt;/RelativeLayout&gt;
          &lt;/TableRow&gt;
  
          &lt;TableRow&gt;
  
              &lt;TextView
                  android:layout_marginLeft="5sp"
                  android:text="@string/difficulty" /&gt;
  
              &lt;RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" &gt;
  
                  &lt;RatingBar
                      android:id="@+id/difficultyDetails"
                      style="?android:attr/ratingBarStyleSmall"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:isIndicator="true"
                      android:max="5"
                      android:numStars="5"
                      android:stepSize="0.1" /&gt;
              &lt;/RelativeLayout&gt;
          &lt;/TableRow&gt;
  
          &lt;TableRow
              android:layout_marginBottom="2sp"
              android:layout_marginTop="2sp" &gt;
  
              &lt;TextView
                  android:layout_marginLeft="5sp"
                  android:text="@string/description" /&gt;
  
              &lt;TextView
                  android:id="@+id/descDetails"
                  android:gravity="top"
                  android:lines="2"
                  android:maxLines="2"
                  android:scrollHorizontally="false" /&gt;
          &lt;/TableRow&gt;
  
          &lt;View
              android:layout_width="fill_parent"
              android:layout_height="1dp"
              android:background="@android:color/darker_gray" /&gt;
      &lt;/TableLayout&gt;
  
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>Here are some screenshots to show you what I mean:</p>
  
  <p>What it should be:</p>
  
  <p><img src="https://i.stack.imgur.com/E9z7sl.png" alt="enter image description here"></p>
  
  <p>What it shouldn't be:</p>
  
  <p>Pushed to the right side of the screen</p>
  
  <p><img src="https://i.stack.imgur.com/9Kycbl.png" alt="enter image description here"></p>
  
  <p>Too much text in description. Goes off the screen</p>
  
  <p><img src="https://i.stack.imgur.com/CWs5zl.png" alt="enter image description here"></p>
  
  <p>Pushed only half way.</p>
  
  <p><img src="https://i.stack.imgur.com/Vh3dEl.png" alt="enter image description here"></p>