服务器之家:专注于服务器技术及软件下载分享
分类导航

PHP教程|ASP.NET教程|Java教程|ASP教程|编程技术|正则表达式|C/C++|IOS|C#|Swift|Android|VB|R语言|JavaScript|易语言|vb.net|

服务器之家 - 编程语言 - Android - Android实现跑马灯效果的方法

Android实现跑马灯效果的方法

2021-04-04 15:44antkingwei Android

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

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

运行效果截图如下:

Android实现跑马灯效果的方法

Android实现跑马灯效果的方法

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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<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"
android:focusableintouchmode="true"
android:scrollhorizontally="true"
android:marqueerepeatlimit="marquee_forever"

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

延伸 · 阅读

精彩推荐