Android使用TextView实现跑马灯效果

        跑马灯效果在网页上经常可以看到,新闻啊,广告什么的都能见到,在Android上实现起来就非常简单了,只要设置几个参数就可以了。

代码如下:

View Code
 1 <TextView
 2         android:id="@+id/tv"
 3         android:layout_width="fill_parent"
 4         android:layout_height="wrap_content"
 5         android:singleLine="true"
 6         android:marqueeRepeatLimit="marquee_forever"
 7         android:focusableInTouchMode="true"
 8         android:ellipsize="marquee"
 9         android:focusable="true">    
10 </TextView>


最后把要显示的文字添加进去后,运行便能看到效果了。

posted @ 2012-10-13 19:07  暴Tyrant君  阅读(66)  评论(0)    收藏  举报