3

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

Community
  • 1
  • 1
YaW
  • 12,132
  • 3
  • 19
  • 23
  • Answered here: http://stackoverflow.com/questions/1827751/android-is-there-a-way-to-make-ellipsizemarquee-always-scroll –  Aug 06 '10 at 10:00

1 Answers1

3

Make tour TextView Selected add this line of code

tvTitulo.setSelected(true);

now more than one TextView marquee will works.

Dipak Keshariya
  • 22,193
  • 18
  • 76
  • 128
Zeeshan Chaudhry
  • 842
  • 2
  • 15
  • 31