I usually do not answer old questions. But in this case, I ran into the same problem, and it was an interesting situation.
Now I have found a patch, one might say, for myself. Marquee text works when it is in focus. Now our goal is to focus on each text screen at the same time.
To do this, we will create our own native component of the TextView component. and will always return true in the isFocusable () method. Here he goes .....
public class ScrollingTextView extends TextView { @Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { if(focused) super.onFocusChanged(focused, direction, previouslyFocusedRect); } @Override public void onWindowFocusChanged(boolean focused) { if(focused) super.onWindowFocusChanged(focused); } @Override public boolean isFocused() { return true; } }
now all you have to do is add this text to your xml layout as follows.
android:text="LONG LONG LONG LONG text..................." android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:id="@+id/TextView03" android:padding="5dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />
and its execution, you can add this TextView component as many times as you want in the xml layout. and all text will be highlighted at the same time.
Thanks.
source share