Q:

TextView with multiple lines of text in a wrapping container - wrong height?

I found the following problem. Having something simple like this works:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="long text taking multiple lines ..."/>

</LinearLayout>

But if you have another component in the layout the TextView starts to behave weird. It seems to be one line short having text running out of the frame of the container:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:textSize="18sp"
    android:text="long text over multiple lines ..."/>

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Bla"/>

</LinearLayout>

Why is this happening?

A:

I was checking if it was some sort of PADDING or MARGIN from the LINEAR LAYOUT or from the TEXTVIEW itself, looks like it's not.
But I was able to  align  it correctly by adding android:layout_gravity="center" on the TEXTVIEW.
<TextView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:textSize="18sp"
    android:layout_gravity="center"
    android:text="long text over multiple lines ..."/>

Some values other than center works too.

