在TextView中省略文本而不是剪切

时间:2015-07-08 10:12:06

标签: android android-layout

在我的ListView行中,我有标题和副标题。如果title需要两行,我希望缩小字幕TextView以缩小内部文本以进行椭圆化以适应剩余空间。标题应优先于字幕。如何防止字幕被裁剪?

enter image description here

这是一行:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="90dp"
    android:background="#FFF">

    <View
        android:id="@+id/news_unread_indicator"
        android:layout_width="5dp"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:background="@color/unread_news" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="90dp"
        android:orientation="vertical"
        android:paddingBottom="10dp"
        android:paddingLeft="15dp"
        android:paddingRight="15dp"
        android:paddingTop="10dp">


        <com.gigaset.elements.ui.custom.CheckBoxMuseo
            android:id="@+id/news_delete_chckbox"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_centerVertical="true"
            android:layout_marginRight="3dp"
            android:adjustViewBounds="true"
            android:focusable="false"
            android:visibility="gone" />

        <com.gigaset.elements.ui.custom.TextViewMuseo
            android:id="@+id/news_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/news_delete_chckbox"
            android:ellipsize="end"
            android:maxLines="2"
            android:textColor="@color/text"
            android:textSize="18sp" />

        <com.gigaset.elements.ui.custom.TextViewMuseo
            android:id="@+id/news_description"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@id/news_title"
            android:layout_below="@id/news_title"
            android:ellipsize="end"
            android:maxLines="2"
            android:textColor="@color/newsfeed_news_subtitle"
            android:textSize="15sp" />
    </RelativeLayout>

</RelativeLayout>

0 个答案:

没有答案
相关问题