Ellipsengröße funktioniert nicht für die Textansicht in der benutzerdefinierten Listenansicht

Ich habe eine ListView mit benutzerdefinierten Objekten, die im folgenden XML-Layout definiert sind. Ich möchte, dass die Textansicht mit der ID "info" in einer einzelnen Zeile elliptisch dargestellt wird, und ich habe versucht, die Attribute zu verwenden

android:singleLine="true"
android:ellipsize="end"

ohne Erfolg.

Wenn ich die layout_width auf eine feste Breite einstelle, wie z.

android:layout_width="100px"

Der Text ist gut abgeschnitten. Aus Gründen der Portabilität ist dies jedoch keine akzeptable Lösung.

Können Sie das Problem erkennen?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="5px"
>
<TextView  
android:id="@+id/destination"
android:layout_width="fill_parent" 
android:layout_height="wrap_content"
android:textSize="22dp"
android:paddingLeft="5px"
/>

<TextView  
android:id="@+id/date"
android:layout_width="fill_parent" 
android:layout_height="wrap_content"
android:textSize="15dp"
android:paddingLeft="5px"
/>

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/info_table"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="5px"
android:paddingTop="10px" 
>
    <TableRow>
        <TextView
            android:id="@+id/driver_label"
            android:gravity="right"
            android:paddingRight="5px"
            android:text="@string/driver_label" />
        <TextView
            android:id="@+id/driver" />
    </TableRow>
    <TableRow>
        <TextView
            android:id="@+id/passenger_label"
            android:gravity="right"
            android:paddingRight="5px"
            android:text="@string/passenger_label" />
        <TextView
            android:id="@+id/passengers" />
    </TableRow>
    <TableRow>
        <TextView
            android:id="@+id/info_label"
            android:gravity="right"
            android:paddingRight="5px" 
            android:text="@string/info_label"/>
        <TextView
            android:id="@+id/info"
            android:layout_width="fill_parent"
            android:singleLine="true"
            android:ellipsize="end" />
    </TableRow>
</TableLayout> 

Antworten auf die Frage(9)

Ihre Antwort auf die Frage