title: TextView populated dynamically cutting off last line of text
body: <p>I'm not sure its only the "last line", but we have an app that has a TextView with fill_parent width, wrap_content height.  Text is being put in there dynamically from the Java code.  The last line of the text simply isn't showing up, even though there's plenty of space in the layout.  Its inside of a fairly deep view hierarchy, so my guess is the measure logic in there is getting messed up, but its pretty frustrating.  We need to guess how many lines are going to be in the text and set 'android:lines' accordingly to get it to work.</p>
  
  <p>Anybody seen this?  In the code, see id 'contentTextView' towards the bottom.  If I take out the 'android:lines', the last line of text disappears.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:background="@drawable/flag"
          &gt;
  
      &lt;include android:id="@+id/incHeader" layout="@layout/header"/&gt;
  
      &lt;FrameLayout
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_weight="1"&gt;
  
          &lt;LinearLayout
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:orientation="vertical"&gt;
  
              &lt;ImageView
                      android:layout_width="fill_parent"
                      android:layout_height="101dp"
                      android:background="@drawable/headershadow"/&gt;
  
              &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:visibility="invisible"
                      android:layout_weight="1"/&gt;
  
  
              &lt;ImageView
                      android:layout_width="fill_parent"
                      android:layout_height="101dp"
                      android:background="@drawable/footershadow"/&gt;
  
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:background="@drawable/gybcontentback"
                  android:layout_gravity="center_horizontal"
                  android:orientation="vertical"&gt;
  
              &lt;include android:id="@+id/gybHeaderInclude" layout="@layout/gybcontentheader"/&gt;
  
  
                  &lt;TextView
                          android:layout_width="fill_parent"
                          android:layout_height="wrap_content"
                          android:textColor="#4f4f4f"
                          android:paddingLeft="15dp"
                          android:paddingRight="15dp"
                          android:lines="9"
                          android:id="@+id/contentTextView"/&gt;
  
              &lt;ImageView
                      android:layout_marginTop="15dp"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:src="@drawable/button_blue_rascal_button"
                      android:id="@+id/buttonMoreInfo"/&gt;
  
          &lt;/LinearLayout&gt;
  
      &lt;/FrameLayout&gt;
  
  
      &lt;include android:id="@+id/incFooter" layout="@layout/menu"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Java code.  I'm populating the TextView with a standard Java string during onCreate.</p>
  
  <pre><code>@Override
  protected String body()
  {
      return "Rascal Flatts and The Jason Foundation, Inc. are working together to prevent suicide.\n\n" +
              "Your Battle Buddy (or family member) may need a friend.\n\n" +
              "Take the pledge to B1.";
  }
  </code></pre>
  
  <p>The base class calls that to get the actual text</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(contentView());
      wireMenu();
  
      TextView headerText = (TextView) findViewById(R.id.gybHeaderText);
      if(headerText != null)
          headerText.setText(header());
  
      ((TextView) findViewById(R.id.contentTextView)).setText(body()); // This is where the text is set
  }
  </code></pre>
  
  <p>Anyway, I'm boiling it down.  I'm cutting out parts to see what's left and still getting the same issue.  I think I may have found the trigger, and a solution, but not the "cause".</p>