Android tips: cut textview and add ellipsis
Single line
Add android:ellipsize=”end” in the properties of the texview.
If you want your text on one line, add android:singleLine=”true”.
Example:
<TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="Text to cut because it is too long" android:ellipsize="end" android:singleLine="true" />
Multi lines
If your textview will be on 2 lines for example, add android:maxLines=”2″ in your textview properties.
Example:
<TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="Text to cut because it is too long but I want it on 2 lines" android:ellipsize="end" android:maxLines="2" />
I hope it helps,
WakeUp Sun