android跑馬燈效果

<TextView 
	    android:layout_height="wrap_content"
	    android:layout_width="fill_parent"
	    android:textSize="30px"
	    android:text="hello,my name is linyuhuan,i am come from canada,where are you come from?"
	    android:singleLine="true"       //是否當行顯示文本
	    android:ellipsize="marquee"//文本超過控件長度,如何處理文本內容,此處爲滾動動畫顯示
	    android:focusable="true"        //是否得到焦點
	    android:focusableInTouchMode="true"    //是否在觸摸模式下得到焦點
	    android:marqueeRepeatLimit="marquee_forever"//重複滾動的次數
	    />

<TextView  java

   android:layout_height="wrap_content"    android:layout_width="fill_parent"    android:textSize="30px"    android:text="11111111111111111111111133333333333344444444488888889999999992"    android:singleLine="true"    android:ellipsize="marquee"    android:focusable="true"    android:focusableInTouchMode="true"/>

運行的結果只有第一個有跑馬燈效果。 android

注意: 動畫

(1)Android的缺省行爲是在控件得到Focus時纔會顯示走馬燈效果

(2)對於一個大View中有不少子View來講,同一時刻只能有一個子View得到focus!也就是說當前這一屏上,最多隻能有一個view能有跑馬燈效果,而不能多個View同事都有跑馬燈效果。 spa

相關文章
相關標籤/搜索