tree hh
tree hh

Reputation: 269

Set value for textview when it too long

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?

Upvotes: 0

Views: 105

Answers (2)

Anandroid
Anandroid

Reputation: 403

Use this in your text view:

android:singleLine="true"

android:ellipsize="end"

Upvotes: 1

Hariharan
Hariharan

Reputation: 24853

Try this..

android:singleLine="true"

android:singleLine

Example

Upvotes: 2

Related Questions