android textview not wrapping correctly

Viewed 17795

I have the following xml to display rows in a listView. I want the TextView with the id rowCreatedAt, to wrap around nicely but it never does and only shows 1 line. I tried most of the solutions in the other questions and added them in the code, but it still doesn't work. Can anyone tell me why...?

+I would like to avoid setting the exact size to the textview.

++ To put it differently, why does the rowCreatedAt textView doesn't wrap the text when width/height is set to fill_parent while other textViews wrap texts just fine?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_margin="5dp"
    android:layout_marginBottom="5dp" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/rowUserImage"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/twitter_icon" 
            android:layout_margin="5dp"/>

        <TextView
            android:id="@+id/rowCreatedAt"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:textSize="10dp"
            android:textColor="#ff696969"
            android:ellipsize="none"
            android:singleLine="false"
            android:scrollHorizontally="false"
            android:layout_weight="1"
            android:maxLines="100"
            android:text="aaaaaaaaaaaaaaabbbbbbbbbbbbbb" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/rowUserName"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:text="username"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/rowText"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:text="status text" />
    </LinearLayout>

</LinearLayout>
4 Answers
Related