I am trying to create an automatic scroll of a TextView when my text is too long. I followed every tutorial or tips posted here on stackoverflow (yes, I read a bunch of topics similar to this, but no one fixed it).
So, I have my activity layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
....
<TextView
android:id="@+id/music_name"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:gravity="center"
android:text="Music Name"
android:textSize="24sp"
android:layout_centerHorizontal="true"
android:singleLine="true"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever" />
....
</RelativeLayout>
And in OnCreate () I do this:
music_name.setSelected(true);
music_name.setMovementMethod(new ScrollingMovementMethod());
music_name is a TextView.
So even do everything that my TextView does not scroll. What could be wrong?
EDIT [NEW]: I noticed that it only works for the first time. In other cases, when I change text in a TextView, it no longer works. What could this do? I have a Timer that wakes up every 50 ms to update SeekBar and the other two TextViews, can this block something?