没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
试读
1页
在Android的ApiDemo中,有Button的走马灯效果,但是换作是TextView,还是有一点差异。 定义走马灯(Marquee),主要在Project/res/layout/main.xml即可 代码如下: <SPAN xss=removed><TextView android:layout_width=”40px” android:layout_height=”wrap_content” android:text=”Test marquee for TextView” android:layout_gravity=”center” android:ellip
资源详情
资源评论
资源推荐
android中设置中设置TextView/Button 走马灯走马灯(Marquee)效果示例效果示例
在Android的ApiDemo中,有Button的走马灯效果,但是换作是TextView,还是有一点差异。
定义走马灯(Marquee),主要在Project/res/layout/main.xml即可
代码如下:
<SPAN style=”COLOR: #993300″><TextView
android:layout_width=”40px”
android:layout_height=”wrap_content”
android:text=”Test marquee for TextView”
android:layout_gravity=”center”
android:ellipsize=”marquee”
android:singleLine=”true”
android:focusable=”true”
android:marqueeRepeatLimit=”marquee_forever”
android:focusableInTouchMode=”true”
android:scrollHorizontally=”true”
/></SPAN>
关键点:关键点:
(1)layout_width设定的长度要比text其实的长度短才行,即layout_width显示不全text才会有走马灯效果 (2)ellipsize 即申
明使用走马灯marquee
(3)singleLine表示单行显示
(4)marqueeRepeatLimit表示走马灯显示的次数:marquee_forever-无限制不间断显示
代码如下:
<SPAN style=”COLOR: #993300″><Button
android:id=”@+id/buttonMarquee”
android:layout_width=”320px”
android:layout_height=”wrap_content”
android:text=”@string/textMarquee”
android:singleLine=”true”
android:focusable=”true”
android:selectAllOnFocus=”true”
android:ellipsize=”marquee”
android:marqueeRepeatLimit=”marquee_forever”
/></SPAN>
其中@string/textMarquee为/res/valuse/strings.xml定义的字符串
您可能感兴趣的文章您可能感兴趣的文章:Android中TextView实现垂直滚动和上下滚动效果Android TextView实现垂直滚动效果的方法Android实
现Activity水平和垂直滚动条的方法Android高仿京东垂直循环滚动新闻栏android listview 水平滚动和垂直滚动的小例子
Android实现文字垂直滚动、纵向走马灯效果的实现方式汇总
weixin_38657102
- 粉丝: 9
- 资源: 935
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0