2
public void startMoveTextView()
{
    int tmpWidth = getWidth() + 100;

    Animation ani = new TranslateAnimation(tmpWidth,tmpWidth * -1,0,0);
    ani.setDuration(10000);
    ani.setRepeatMode(Animation.RESTART);
    ani.setRepeatCount(Animation.INFINITE);
    ani.setInterpolator(new LinearInterpolator());

    String tmpLongText = "Long text"
    textview.setText(tmpLongText);

    textview.startAnimation(ani);
}
<TextView
    android:id="@+id/tv"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:maxLines="1"
    android:textColor="@color/news_text_color"
    android:text=""
    android:textSize="20sp" />

I'm animating long text from right to left

However, in case of long characters, only part of the characters are displayed.

For example, if there are 100 characters, only 20 characters will be displayed.

Is there a way to display the entire text?

swiftbegineer
  • 329
  • 1
  • 9
  • TranslateAnimation is for animating views and not its contents. You will need some kind of threads to animate that text. – Darkman Mar 01 '22 at 16:29
  • Can I get some hints? – swiftbegineer Mar 02 '22 at 04:58
  • Forget what I've said. That's gonna break many multiwide characters. This [thread](https://stackoverflow.com/questions/18826870/how-to-animate-the-textview-very-very-long-text-scroll-automatically-horizonta) has a lot answers for your problem. – Darkman Mar 02 '22 at 05:56

0 Answers0