Reputation: 2370
My TextView Tag looks like this
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/search_pickup_address"
android:drawablePadding="@dimen/space"
android:scrollHorizontally="false"
android:ellipsize="end"
android:inputType="text"
android:maxLines="1"
android:minLines="1" />
I have set all this attributes
android:scrollHorizontally="false"
android:ellipsize="end"
android:maxLines="1"
android:minLines="1"
As Single line true method is deprecated
android:singleLine="true"
When i have used this method dots are showing fine.
String label;
if (string.length() >= 35) {
label= data.substring(0, 35)+ "...";
} else {
label= data;
}
textView.setText(label);
But is there any direct method like
android:singleLine="true"
Upvotes: 5
Views: 1899
Reputation: 1791
You can user attribute:
android:ellipsize="end"
android:singleLine="true"
I hope it helps you!
Upvotes: 0
Reputation: 71
you can use
android:ellipsize="end"
android:maxLines="1"
android:minLines="1"
android:singleLine="true"
Upvotes: 4