2012-04-13 12 views
0

Ich habe eine Tabelle mit mehreren Zeilen ähnlich wie diesen:Ellipsize nicht richtig funktioniert in einem Textview in einem Tablelayout

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

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="text" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:textSize="12sp" 
     android:layout_gravity="right|center_vertical" 
     android:layout_margin="4dip" /> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="some text" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textSize="13sp" 
     android:textStyle="bold" 
     android:layout_gravity="left|center_vertical" 
     android:layout_margin="4dip" 
     android:ellipsize="end" 
     android:lines="1" 
     android:scrollHorizontally="true" 
     android:layout_weight="1" /> 

    <ImageView 
     android:src="@drawable/disclosure_indicator" 
     android:contentDescription="@string/emptyString" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:scaleType="fitXY" /> 

</TableRow> 

Aber die zweite Textview hat es letztes ‚Wort‘ ist ersetzt durch ‚...‘ wenn überhaupt Zeile in der Textansicht ist breiter als der verbleibende Speicherplatz.

So etwas mit wie:

"Some sort string" 
"Some string that is a little bit longer" 
"Singleword" 

Der Tisch wie so machen wird:

text | Some short...      | > 
text | Some string that is a little bit... | > 
text |          | > 

Wenn klar ist genügend Platz die gesamte Zeichenfolge für die erste Zeile angezeigt werden soll. Wie kann ich es so kürzen/Elipsis funktioniert für jede Zeile richtig?

+0

http://stackoverflow.com/questions/3332924/textview-marquee-not-working – yokees

Antwort

-1

@ MarSara9 Ändern Sie die Layout-Schwerkraft der 2. Textansicht. Diese Lösung funktioniert mit Ihrem Beispielcode:

android: layout_gravity = "center_vertical"

Verwandte Themen