views:

157

answers:

1

Hi,

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