Frage

I've this xml for a custom row in a ListView cell, but the TextView 'commentTextView' is getting wrapped, and doesn't respect his father width.

    <!-- top left bend -->
    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
        <ImageView style="@style/FormImageViewTopLeftBendStyle"
            android:contentDescription="@string/none" 
        />   
    </TableRow>
    <!-- top left bend -->

    <!-- Photo & Comment -->

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <!-- User Photo  -->

         <ImageButton style="@style/FormBasicStyle"
             android:id="@+id/userImage"
             android:background="@drawable/ic_default_user"
             android:contentDescription="@string/user_photo_description" 
             />

        <!-- User, Comment & Time -->

        <TextView
            android:id="@+id/commentTextView"
            style="@style/FormTextViewStyle"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="0dp"
            android:background="@color/yellow"
            android:singleLine="false"
            android:text="@string/the_text_commented"   
         />        
   </TableRow>
</TableLayout>

Problem With TextView

What I have to do to make a multiline TextView that doesn´t gets wrapped?

War es hilfreich?

Lösung

Remove this

android:layout_width="wrap_content"
android:layout_height="match_parent"

And add a layout weight element with weight other than 0

android:layout_weight="1"

It's worked for me. But i couldn't find what's happening there.

Andere Tipps

set layout_width to match_parent

android:layout_width="match_parent"
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top