如何像跑马灯一样给文本视图增加动画效果?

4

我有一个文本视图需要使用动画沿屏幕滚动(就像在新闻频道上闪烁的新闻一样),现在我该如何在Android中实现它?我尝试了这个答案,但没有得到解决方案,请帮帮我吗?


你尝试过动画框架吗? - jeet
不要解释如何使用它,只翻译以下与编程有关的内容。 - Ramz
请查看以下链接:http://stackoverflow.com/questions/9138375/how-to-move-a-drawable-across-the-screen/9138560#9138560 - jeet
请参考此链接:https://dev59.com/h2855IYBdhLWcg3wbzxl - Shishir Shetty
1个回答

7

main.xml

    <TextView
    android:id="@+id/mywidget"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:lines="1"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:textColor="#ff4500"
    android:text="Simple application that shows how to use marquee, with a long text" 
     />

Java类

    TextView tv = (TextView) this.findViewById(R.id.mywidget);  
    tv.setSelected(true);  // Set focus to the textview

我需要在我的Java文件中做任何事情来实现这个效果吗? - Ramz
2
Android(用户):是的,我将编辑您的答案,我们需要进行一些修改。 - Ramz

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接