2012-02-11 26 views
4

我有一個文本視圖,我需要使用animation.now我怎樣才能實現這個android中我試圖this answer如何像文字框一樣動畫文字視圖?

到選取框沿着屏幕的(如閃存新聞在新聞頻道閃爍),但並沒有得到解決,請幫幫我?

+0

你嘗試過的動畫框架。 – jeet 2012-02-11 09:51:22

+0

不,我該如何使用,請解釋一下? – Ramz 2012-02-11 09:54:47

+0

檢查鏈接:http://stackoverflow.com/questions/9138375/how-to-move-a-drawable-across-the-screen/9138560#9138560 – jeet 2012-02-11 10:01:33

回答

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 
+0

我需要在我的java文件做任何事爲此效果 – Ramz 2012-02-11 13:39:01

+0

不需要在java文件中的任何代碼... – Android 2012-02-11 13:42:13

+2

Android(用戶):是的,我要編輯你的答案,我們需要一點點修改來做到這一點 – Ramz 2012-02-13 04:22:53