How can I highlight text content in a notification?

The text content is too long to be displayed in the notification, and it is cut. What can I do? Please, help.

+6
source share
3 answers

Try the following:

This works for me, I tested it.

First create a custom notification:

as shown here: Link to the developer's site .

After that, in the TextView of the message you want to highlight, enter the following line:

android:ellipsize="marquee" 

And it works the way you want. Enjoy. Hope this helps you. Thanks.

+3
source

Set up a custom layout for notification. In the layout, use TextView for notification, then in the XML for TextView add:

 android:ellipsize="marquee" 
+1
source
  <TextView android:id="@+id/place" android:layout_toRightOf="@+id/line1" android:clickable="true" android:ellipsize="marquee" android:fadingEdge="horizontal" android:gravity="bottom" android:lines="1" android:marqueeRepeatLimit="marquee_forever" android:paddingLeft="4dip" android:scrollHorizontally="true" android:textColor="#00BFFF" android:textSize="18dip" /> 

Remove any useless string and change the id according to ur code.

+1
source

Source: https://habr.com/ru/post/900050/


All Articles