Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Ellipsize" only shows one dot

On my Samsung Galaxy Nexus, behavior is OK, it shows three dots, but in Samsung S2, it shows only one dot. There is only one layout file:

<TextView
    android:id="@+id/textViewOfferTitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toLeftOf="@+id/textViewRedemptionDate"
    android:layout_alignParentLeft="true"
    android:ellipsize="end"
    android:singleLine="true"
    android:textColor="@color/pontai_dark_gray"
    android:textSize="@dimen/ndp_font_size" />

This is the example:

http://img109.imageshack.us/img109/5118/96452147.png

Has anyone seen this?

like image 425
Felipe Caldas Avatar asked Mar 07 '13 19:03

Felipe Caldas


2 Answers

There is no guarantee on how text will be ellipsized (a single dot is a little misleading if you ask me, but it can be interpreted as an abreviation). If you want to ensure the "three-dots" behavior, you are free to subclass TextViewand add your custom behavior. An example can be seen on this SO question (just do not bother with the "multiple line" part of the code). Long story short, a single dot for ellipsis should not be an issue.

like image 198
apenasVB Avatar answered Oct 01 '22 16:10

apenasVB


remove

android:singleLine="true"

and try

android:lines="1"
android:ellipsize="end"

It works for me.

like image 22
Ding Ke Avatar answered Oct 01 '22 14:10

Ding Ke