0

At the moment,I have textView and I want to check if in one device, if textview display more one lines.I will get the first lines.Then remove last three character and replace by "..." if textview display not full width of device,i will display full text. This is xml file of textview

    <TextView
    android:id="@+id/textViewListSuggest"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="15dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_marginTop="15dp"
    android:text="@string/app_name"
    android:textColor="@android:color/black" />

How must I do?

tree hh
  • 269
  • 1
  • 5
  • 16

2 Answers2

2

Try this..

android:singleLine="true"

android:singleLine

Example

Community
  • 1
  • 1
Hariharan
  • 24,741
  • 6
  • 50
  • 54
1

Use this in your text view:

android:singleLine="true"

android:ellipsize="end"

Anandroid
  • 403
  • 4
  • 14