我有一个动态布局,其中包含一个到六个TextViews。所有的TextView都在Activity中创建(以编程方式),并且都是平等创建的。
我想在TextViews中使用跑马灯,但我不知道该怎么做。显然,TextView需要聚焦才能正常工作,但是如何同时聚焦六个TextView?我认为这是不可能的,那么是否有任何解决方法?是否可能在没有焦点的情况下使跑马灯工作?
这是TextView的代码:
//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);
如果我删除tvTitulo.setFocusableInTouchMode(true);
这一行,则跑马灯根本不起作用。
如果我不删除该行,则只有一个TextView的跑马灯起作用。
问候