android textview 跑马灯 滚动效果
2012-06-08 13:32
369 查看
it's easy to do via XML. Use the following settings:
android:singleLine="true" 单行显示android:ellipsize="marquee" [b]跑马灯显示android:marqueeRepeatLimit="marquee_forever" 设置重复滚动的次数,无限次android:focusable="false" 设置是否获得焦点[/b](当执行了setFocusable (false)后,再执行 setFocusable (true) 无法输入,也获取不了焦点了。
试了一下setFocusableInTouchMode(false)后,再执行setFocusableInTouchMode(true),可以正常输入,也能正常获取焦点。
setFocusableInTouchMode 与 setFocusable 之间有什么区别呢?)
android:scrollHorizontally="true" 超过textview宽度时,是否出现横拉条
If your TextView is within a RelativeLayout, the width or height will have to be static (i.e. 32dp). If you need dynamic, place the TextView in another View within the RelativeLayout.
In onCreate(), you need to make the TextView selected:
myTextView.setSelected(true);---------------------------------------android:ellipsize="start" 省略号在开头
android:ellipsize="middle" 省略号在中间
android:ellipsize="end" 省略号在结尾
android:ellipsize="marquee" 跑马灯显示
或者在程序中可通过setEillpsize显式设置。
注: EditText不支持marquee这种模式。--------------------------------------注:多个TextView同时跑马灯效果
解决方案:设置android:ellipsize="marquee",[b]android:singleLine="true",android:marqueeRepeatLimit="marquee_forever"然后代码中只要textview.setSelected(true);就行了,不用去重写Textview返回焦点为true[/b]
android:singleLine="true" 单行显示android:ellipsize="marquee" [b]跑马灯显示android:marqueeRepeatLimit="marquee_forever" 设置重复滚动的次数,无限次android:focusable="false" 设置是否获得焦点[/b](当执行了setFocusable (false)后,再执行 setFocusable (true) 无法输入,也获取不了焦点了。
试了一下setFocusableInTouchMode(false)后,再执行setFocusableInTouchMode(true),可以正常输入,也能正常获取焦点。
setFocusableInTouchMode 与 setFocusable 之间有什么区别呢?)
android:scrollHorizontally="true" 超过textview宽度时,是否出现横拉条
If your TextView is within a RelativeLayout, the width or height will have to be static (i.e. 32dp). If you need dynamic, place the TextView in another View within the RelativeLayout.
In onCreate(), you need to make the TextView selected:
myTextView.setSelected(true);---------------------------------------android:ellipsize="start" 省略号在开头
android:ellipsize="middle" 省略号在中间
android:ellipsize="end" 省略号在结尾
android:ellipsize="marquee" 跑马灯显示
或者在程序中可通过setEillpsize显式设置。
注: EditText不支持marquee这种模式。--------------------------------------注:多个TextView同时跑马灯效果
解决方案:设置android:ellipsize="marquee",[b]android:singleLine="true",android:marqueeRepeatLimit="marquee_forever"然后代码中只要textview.setSelected(true);就行了,不用去重写Textview返回焦点为true[/b]
相关文章推荐
- Android自定义textview实现竖直滚动跑马灯效果
- Android中TextView实现垂直滚动(轮换效果,非跑马灯)
- Android中TextView实现文字跑马灯效果(滚动轮播)
- Android TextView 横向滚动(跑马灯效果)
- Android TextView实现垂直滚动的跑马灯效果
- Android TextView实现滚动跑马灯效果Marquee
- 一分钟实现 Android textview 跑马灯文字滚动效果
- Android TextView 横向滚动(跑马灯效果)
- android中TextView中文本滚动的跑马灯效果
- android TextView实现实现跑马灯效果,并监听滚动完成动作。
- Android之如何用TextView实现滚动字幕的效果【跑马灯】
- Android textView点击滚动(跑马灯)效果
- AndroidStudio——TextView文字左右滚动(跑马灯效果)无效解决办法
- Android TextView 字体滚动效果
- Android中TextView实现的“跑马灯”效果
- Android控件之TextView跑马灯效果
- Android TextView实现跑马灯效果
- Android开发实现TextView跑马灯效果
- android - TextView单行显示...或者文字左右滚动(走马灯效果)
- Android:TextView 自动滚动(跑马灯)