Continuously animate Text from left to right

后端 未结 3 967
温柔的废话
温柔的废话 2021-02-06 16:14

I\'m trying to create an animation which moves a TextView from left to right and loop indefinitely. This is the TextView I want to animate:

<         


        
3条回答
  •  攒了一身酷
    2021-02-06 16:28

    Android has a built-in solution for this called 'marquee'.

    Add these lines to your TextView.

    
    

    Then simply call

    txtTitle.setText(title);
    txtTitle.setSelected(true);
    

    However, this only works if the text is long enough to go out of bounds.

提交回复
热议问题