Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Marquee in various TextView at the same time? [duplicate]

Possible Duplicate:
Is there a way to make ellipsize=“marquee” always scroll?

I have a dynamic layout wich has one to six TextViews. All the TextViews are created in the Activity (programatically) and all are created equally.

I want to marquee the text in the TextViews, but I don't know how to do it. Apparently, the TextView needs to be focused for the marquee works fine, but how i focus six TextViews at the same time? I think that's not possible, so, is there any workaround? Is it possible to get the marquee working without having the focus?

This is the code of the TextViews:

//TextView
TextView tvTitulo = new TextView(this);
tvTitulo.setText("Some loooooooooooooooooooooong text");
tvTitulo.setTypeface(null, Typeface.BOLD);
//Marquee
tvTitulo.setSingleLine();
tvTitulo.setEllipsize(TruncateAt.MARQUEE);
tvTitulo.setHorizontallyScrolling(true);
tvTitulo.setFocusableInTouchMode(true);

If I remove the line tvTitulo.setFocusableInTouchMode(true); the marquee is not working at all. If I don't remove the line, only one of the TextViews is getting the marquee working.

Greetings

like image 446
YaW Avatar asked Nov 23 '25 00:11

YaW


1 Answers

Make tour TextView Selected add this line of code

tvTitulo.setSelected(true);

now more than one TextView marquee will works.

like image 91
Zeeshan Chaudhry Avatar answered Nov 25 '25 21:11

Zeeshan Chaudhry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!