android TextView跑马灯效果实现

来源:互联网 发布:网络翻译兼职 编辑:程序博客网 时间:2024/04/30 05:37

xml源码如下:

<TextView    android:text="START | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | END"    android:id="@+id/MarqueeText"     android:layout_width="marth_parent"    android:layout_height="wrap_content"     android:singleLine="true"   android:ellipsize="marquee"    android:marqueeRepeatLimit="marquee_forever"   android:scrollHorizontally="true"     android:paddingLeft="15dip"     android:paddingRight="15dip"     android:focusable="true"    android:focusableInTouchMode="true"     android:freezesText="true">
        如上面所示,粗体部分为必要的一些属性,其次!!!,需要在代码中添加:

textView.setSelected(true);
   但是,使用过程可能还是会遇到效果没有出现情况:

(1)、高度使用固定值,效果出不来!有遇到的可以补充下。


参考资源:http://stackoverflow.com/questions/3332924/textview-marquee-not-working

0 0
原创粉丝点击