tags:

views:

98

answers:

2

alt text

First off, sorry about the large screen. I am trying to get the text to wrap but am currently unable to do so. I have tried android:layout_width="fill_parent", android:scrollHorizontal="false", android:width="0dip" all of which suggested in another question. Does anyone have any idea how I can achieve text wrapping? Here's a sample of the xml:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent">

<TableLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:stretchColumns="2">

    <TableRow>

        <TextView
            android:layout_column="1"
            android:gravity="center"
            android:background="@drawable/lgrayborder"
            android:paddingRight="5dip"
            android:paddingLeft="5dip"
            android:id="@+id/chatUser1"/>

        <TextView
            android:layout_column="1"
            android:gravity="left"
            android:background="@drawable/lgrayborder"
            android:paddingLeft="5dip"
            android:id="@+id/chatComm1"/>

    </TableRow>

    <TableRow>

        <TextView
            android:layout_column="1"
            android:gravity="center"
            android:background="@drawable/lgrayborder"
            android:paddingRight="5dip"
            android:paddingLeft="5dip"
            android:id="@+id/chatUser2"/>

        <TextView
            android:layout_column="1"
            android:gravity="left"
            android:background="@drawable/lgrayborder"
            android:paddingLeft="5dip"
            android:id="@+id/chatComm2"/>

    </TableRow>
 </TableLayout>
 </ScrollView>

Update: I have tried setting attributes in the ScrollView, TableLayout, and TableRow in hopes that it would force the TextViews to wrap but to no avail. Still looking for a solution to this.

A: 

You need to set the ellipsize property of the TextView.

Karan
I tried these three android:ellipsize="start", android:singleLine="false", android:scrollHorizontally="false", and none of them worked. Also, Ellipsize is so that words don't get broken in the middle, useful but does not really solve the main issue.
Alejandro Huerta
Try singleLine="true" and ellipsize="end". HTH !
Karan
Still does not solve it. I tried every combination...
Alejandro Huerta
+1  A: 

Have you already tried to use

android:maxEms="int"

in combination with ellipsize? This should solve your problems.

Octavian Damiean
You sir, are a <*explicit*> genius. Thank you.
Alejandro Huerta