Marquee in various TextView at the same time?
Posted
by YaW
on Stack Overflow
See other posts from Stack Overflow
or by YaW
Published on 2010-05-12T07:38:35Z
Indexed on
2010/05/12
7:44 UTC
Read the original article
Hit count: 395
Hi,
I have a dinamic 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
© Stack Overflow or respective owner