TextView实现跑马灯效果 以以实现TextView没有边框 设置我们自己的背景
2015-01-30 17:49
549 查看
<TextView
android:layout_width="100px"
android:layout_height="wrap_content"
android:text="234254fadfadffadfadfgfhdgfhjhfjhfjhjfhjfhjfhjfhjtyteytryet"
android:marqueeRepeatLimit="marquee_forever"
android:ellipsize="marquee"
android:scrollHorizontally="true"
android:focusableInTouchMode="true"
android:focusable="true"></TextView>
除了跑马灯之外 我们还可以通过 scrollView 来实现我们的textview滚动显示。
TextView出去边框就是我们设置背景位null
android:layout_width="100px"
android:layout_height="wrap_content"
android:text="234254fadfadffadfadfgfhdgfhjhfjhfjhjfhjfhjfhjfhjtyteytryet"
android:marqueeRepeatLimit="marquee_forever"
android:ellipsize="marquee"
android:scrollHorizontally="true"
android:focusableInTouchMode="true"
android:focusable="true"></TextView>
android:layout_width="100px" //文字宽度不能是wrap_content(后面更正,可以是!),//这样的跑步起来
android:marqueeRepeatLimit="marquee_forever"//表示滚动回数,这里这么设置,表示一直滚动 android:ellipsize="start" 省略号在开头 android:ellipsize="middle" 省略号在中间 android:ellipsize="end" 省略号在结尾 android:ellipsize="marquee" 跑马灯显示 或者在程序中可通过setEillpsize显式设置。
android:focusable="true" //要显示该跑马灯,view必须要获得焦点,只有在取得焦点的情况下跑马灯才会显示
更新: 用此例在android4.0.3上不能跑起来跑马灯的效果,需加 android:singleLine="true" 当为一行的时候,才有跑马灯效果。
(4)android:focusableInTouchMode:是否在触摸模式下获得焦点。
除了跑马灯之外 我们还可以通过 scrollView 来实现我们的textview滚动显示。
TextView出去边框就是我们设置背景位null
相关文章推荐
- TextView使用SpannableString设置复合文本 SpannableString实现TextView的链接效果
- 解决TextView设置跑马灯但却没有效果
- 解决TextView设置跑马灯但却没有效果
- TextView属性android:ellipsize实现跑马灯效果,TextView内容过长加省略号,点击显示全部内容
- TextView设置android:ellipsize="marquee"属性,无法实现跑马灯效果的解决方法
- Android给TextView设置透明背景、圆角边框
- android TextView实现跑马灯效果
- android用TextView实现跑马灯效果
- 自定义TextView实现跑马灯效果
- Android实现多个TextView同时显示跑马灯效果
- Android中TextView不获取焦点可以实现跑马灯的效果
- Android给TextView设置透明背景、圆角边框
- Android实现多个TextView同时显示跑马灯效果
- Android TextView实现跑马灯效果
- TextView实现跑马灯效果
- Android常用UI编程_TextView实现跑马灯效果
- textview 设置跑马灯效果
- TextView实现跑马灯效果
- Android实现多个跑马灯效果,多个文本框TextView的跑马灯
- (转)#小美化#Android给TextView设置透明背景、圆角边框