Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom notification marquee text doesnt work android

Hi im trying to make part of my text in the notification manager marquee but doesnt work i tried this:

  <TextView
    android:id="@+id/title_text"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:gravity="bottom"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"                                     
    android:focusable="true"
    android:focusableInTouchMode="true"              
    android:singleLine="true"
    android:textSize="15sp"
    android:textStyle="bold" >
  </TextView>

and in my .java i use remoteview:

Notification notification = new Notification(icon, tickerText, when);
RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.notification);

contentView.setTextViewText(R.id.title_text, "This is a very long text which is not fitting in the screen so it needs to be marqueed");

i would like to have marquee for that title_text This is a very long text which is not fitting in the screen so it needs to be marqueed

but the marquee doesnt work just stays static what i can do?

thank you.

like image 949
alexistkd Avatar asked Dec 15 '22 18:12

alexistkd


1 Answers

i changed my xml:

  <TextView
    android:id="@+id/title_text"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:gravity="bottom"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="false"                                     
    android:focusable="true"
    android:focusableInTouchMode="true"              
    android:singleLine="true"
    android:textSize="15sp"
    android:textStyle="bold" 
    android:textColor="#fff">
    <requestFocus/> 
  </TextView>

i added <requestFocus/> and now my marquee works perfect.

like image 107
alexistkd Avatar answered Feb 04 '23 08:02

alexistkd