Textview show partial text Textview show partial text android android

Textview show partial text


In XML, use the property android:ellipsize="marquee"for the TextView.

Your TextView can be defined like:

<TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxLines="2" android:lines="2" android:ellipsize="marquee"/>

Edit: I've tried the following code, adapted from yours:

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:id="@+id/rlt_news"    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:background="@drawable/cell_background"    android:padding="5dip" >    <TextView        android:id="@+id/tv_title"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:layout_alignParentTop="true"        android:paddingLeft="5dip"        android:text="Name"        android:textStyle="bold" />    <ImageView        android:id="@+id/rss_icon"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_below="@id/tv_title"        android:layout_marginLeft="2dip"        android:adjustViewBounds="true"        android:maxHeight="100dip"        android:maxWidth="100dip"        android:src="@drawable/rss_cell_icon"        android:visibility="visible" />    <TextView        android:id="@+id/tv_description"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_alignParentTop="true"        android:layout_marginLeft="2dp"        android:layout_marginTop="4dp"        android:layout_toRightOf="@id/rss_icon"        android:ellipsize="marquee"        android:gravity="top"        android:lines="2"        android:maxLines="2"        android:paddingBottom="5dp"        android:paddingRight="7dp"        android:text="Description of the news, just the short paragraph, \nSignature, to see how it works if there are more than two lines"        android:textColor="@android:color/black"        android:textSize="12sp"        android:typeface="sans" /></RelativeLayout>

And here is the output:
enter image description here


Use android:ellipsize="end" instead of "marquee" that did it for me.


Gabi,

I was also having the same problem. To enable ellipsize on a textview with 2 lines I use the following parameters:

android:maxLines="2"   // You already got this oneandroid:ellipsize="end" // also this oneandroid:singleLine="false"  // This is the command that solves your problem.

Unfortunately I got a new scenario for my app. I have to use 3 lines with ellipsize and this configuration only works for 2 lines... :( Good luck