Я использую android:ellipsize="end" в файле android xml, и, что удивительно, я не получаю макет, который хочу, отображаются 3 точки (...), но после этих точек есть еще одно слово усечено. Также это «не всегда» поведение, проверьте прикрепленный ListView, иногда поведение нормальное, а иногда нет.
Вот скриншот раскладки с моего устройства,
Я понятия не имею, почему это происходит. Вот мой xml-файл, проблема с tv_news_content TextView -
<?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="100dp"
android:background="@color/white" >
<ImageView
android:id="@+id/iv_next_tier"
android:layout_width="18dp"
android:layout_height="21dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:src="@drawable/right_arrow" >
</ImageView>
<TextView
android:id="@+id/tv_news_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="7dp"
android:layout_marginRight="5dp"
android:layout_marginTop="3dp"
android:layout_toLeftOf="@+id/iv_next_tier"
android:ellipsize="end"
android:maxLines="2"
android:text="News Title"
android:textColor="@color/black"
android:textSize="17dp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_news_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/tv_news_title"
android:layout_below="@+id/tv_news_title"
android:layout_marginRight="5dp"
android:layout_toLeftOf="@+id/iv_next_tier"
android:ellipsize="end"
android:maxLines="2"
android:text="News Contents"
android:textColor="@color/black_light"
android:textSize="15dp" />
<View
android:id="@+id/view"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_below="@+id/tv_news_content"
android:layout_marginTop="5dp" />
To make things clear, tv_news_title is the topmost bold TextView, & iv_next_tier is the small arrow-type ImageView at the right. & tv_news_content is the TextView that I am facing problem with.
Любое решение, почему я не получаю желаемого результата? Желаемый вывод означает всегда нормальное поведение - мне нужны эти 3 точки в конце второй строки tv_news_content TextView, а не перед усеченным словом.
Любое предложение приветствуется.
maxLines="2"
наlines="2"
? - person Ken Wolf   schedule 16.06.2013