首页 > 系统 > Android > 正文

Android实现跑马灯效果的方法

2019-10-24 20:35:52
字体:
来源:转载
供稿:网友

这篇文章主要介绍了Android实现跑马灯效果的方法,通过页面XML布局设置实现带有跑马灯效果的文字滚动显示功能,具有一定参考借鉴价值,需要的朋友可以参考下

本文实例讲述了Android实现跑马灯效果的方法。分享给大家供大家参考。具体如下:

运行效果截图如下:

Android实现跑马灯效果的方法

Android实现跑马灯效果的方法

直接在布局里写代码就好了:

 

 
  1. <TextView 
  2. android:id="@+id/menu_desc" 
  3. android:layout_width="300dip" 
  4. android:layout_height="wrap_content" 
  5. android:text="温馨提示:左右滑动更改菜单,点击进入" 
  6. android:textColor="@color/white" 
  7. android:textSize="22dip" 
  8. android:singleLine="true" 
  9. android:ellipsize="marquee" 
  10. android:focusable="true" 
  11. android:focusableInTouchMode="true" 
  12. android:scrollHorizontally="true" 
  13. android:marqueeRepeatLimit="marquee_forever" 
  14. android:layout_centerHorizontal="true" 
  15. android:layout_centerVertical="true" 
  16. </TextView> 

主要是这几行:

android:singleLine="true"

android:ellipsize="marquee"

android:focusable="true"

android:focusableInTouchMode="true"

android:scrollHorizontally="true"

android:marqueeRepeatLimit="marquee_forever"

希望本文所述对大家的Android程序设计有所帮助。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表