易采站长站为您分析Android实现跑马灯效果的方法,通过页面XML布局设置实现带有跑马灯效果的文字滚动显示功能,具有一定参考借鉴价值,需要的朋友可以参考下
本文实例讲述了Android实现跑马灯效果的方法。。具体如下:
运行效果截图如下:


直接在布局里写代码就好了:
- <TextView android:id="@+id/menu_desc"
- android:layout_width="300dip" android:layout_height="wrap_content"
- android:text="温馨提示:左右滑动更改菜单,点击进入" android:textColor="@color/white"
- android:textSize="22dip" android:singleLine="true"
- android:ellipsize="marquee" android:focusable="true"
- android:focusableInTouchMode="true" android:scrollHorizontally="true"
- android:marqueeRepeatLimit="marquee_forever" android:layout_centerHorizontal="true"
- android:layout_centerVertical="true" >
- </TextView>
主要是这几行:
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"










