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

相关文章
相关标签/搜索