I know this question is asked many times, i have gone through all the solutions but still the problem is same.
i want my text length to be of 50 characters. now it is coming in 2 lines.
Below is what i did:
<TextView
android:id="@+id/notification_Message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/notification_head"
android:layout_centerHorizontal="true"
android:layout_margin="10dp"
android:gravity="center"
android:ellipsize="end"
android:maxLength="50"
android:text=" Hello developer. please check this message for long length. max length to 50 characters. "
android:textSize="20sp" />
The text here is just a sample text i have added. it is not showing 3 dots at end rather showing message upto 50 characters. i have tried max lines also, single line false also. but no positive result. I also don't want to handle this thing programmatically by adding three dots logically.
Please help
Make a preset width for your TextView and add these attributes (Shout-out to @T-D)
android:ellipsize="end"
android:maxLines="1"
The maxLines will make sure that your text wont be shown in two lines and the ellipsize will add the three dots in the end.
Old Answer
android:ellipsize="end"
android:singleLine="true"