Установка размера эллипса в TextView уменьшает количество строк, показанных на одну (вместо того, чтобы только эллипсировать последний)

когда я используюTextView сsingleLine="true" а такжеellipsize="end"(мой топ TextView), it works well

but in another TextView имея более 1 строки (в моем случае 3 строки в моем днеTextView), lines="3" and maxLines="3" and ellipsize="end", doesn't work properly.

Когда я не ставлюellipsize="end" в tvDesc он показывает 3 строки, что нормально. Вот код: XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ImageView
        android:id="@+id/imgv"
        android:layout_width="65dp"
        android:layout_height="80dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/img1"
        android:scaleType="fitXY" />

    <TextView
        android:id="@+id/tvTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/imgv"
        android:background="@android:color/white"
        android:textColor="@android:color/black"
        android:text="Title testing line number and ellipsize at end"
        android:maxLines="1"
        android:singleLine="true"
        android:ellipsize="end"    <---  WORKS WELL
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/tvDesc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/tvTitle"
        android:layout_toRightOf="@+id/imgv"
        android:layout_alignBottom="@+id/imgv"
        android:layout_alignParentRight="true"
        android:textSize="14dp"
        android:lines="3"
        android:maxLines="3"
                       <----------  WITHOUT ellipsize

        android:text="I wanna this textview of having 3 lines and ellipsize at END and at this time I am Testing for it. This TextView shows 3 lines WITHOUT ellipsize property, but shows only 2 Lines when ELLIPSIZE property is setted"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</RelativeLayout>

Above code shows TextView tvDesc with 3 Lines and No-Ellipsize. Вот изображение:

enter image description here

But, I wanna ellipsize, so I uses followin code : XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ImageView
        android:id="@+id/imgv"
        android:layout_width="65dp"
        android:layout_height="80dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/img1"
        android:scaleType="fitXY" />

    <TextView
        android:id="@+id/tvTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/imgv"
        android:background="@android:color/white"
        android:textColor="@android:color/black"
        android:text="Title testing line number and ellipsize at end"
        android:maxLines="1"
        android:singleLine="true"
        android:ellipsize="end"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/tvDesc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/tvTitle"
        android:layout_toRightOf="@+id/imgv"
        android:layout_alignBottom="@+id/imgv"
        android:layout_alignParentRight="true"
        android:textSize="14dp"
        android:lines="3"
        android:maxLines="3"
        android:ellipsize="end"    <------  WITH  ELLIPSIZE

        android:text="I wanna this textview of having 3 lines and ellipsize at END and at this time I am Testing for it. This TextView shows 3 lines WITHOUT ellipsize property, but shows only 2 Lines when ELLIPSIZE property is setted"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</RelativeLayout>

Which shows TextView tvDesc with only 2 lines and Ellipsize,

который не является должным образом удаленным пользовательским интерфейсом, как Followin: enter image description here

I wanna 3 lines in TextView tvDesc with ellipsize

CAN ANYONE HELP ME.?

Ответы на вопрос(6)

Ваш ответ на вопрос