首页 > 移动平台 > 详细

android用TextView实现跑马灯效果

时间:2014-03-05 14:30:45      阅读:513      评论:0      收藏:0      [点我收藏+]

今天搞啦很久,其实很简单,就加几个属性就可以啦!

图如下 :

bubuko.com,布布扣

bubuko.com,布布扣

 

bubuko.com,布布扣

 

 

有的说要重写TextView方法,有的说要设置固定长度,但是我没重写也没有设置固定长度也弄出来啦!跑在2.3.3的手机上面。就是不知道其他地方能不能实现这种效果!

 

代码如下:(其他地方代码没什么关系) 

  1.   <TextView  
  2. android:layout_width="fill_parent"  
  3. android:layout_height="wrap_content"    
  4. android:id="@+id/notice"    
  5. android:background="@color/black20"     
  6. android:text="他们说这里是要放广告的,就是看看能不能动啊!长点...!!!!..."    
  7. android:ellipsize="marquee"    
  8. android:gravity="center"    
  9. android:textStyle="bold"    
  10. <span style="color:#ff0000;">android:focusable="true"    
  11. android:marqueeRepeatLimit="marquee_forever"    
  12. android:focusableInTouchMode="true"    
  13. android:scrollHorizontally="true"    
  14. android:singleLine="true"  </span>  
  15. android:textSize="@dimen/activity_Textsize15_4.0"    
  16. />    
  17.    

 

注意的就是内容一点要够长才会滚动,不然就不会滚动。 红色标记的代码是关键代码。

android用TextView实现跑马灯效果,布布扣,bubuko.com

android用TextView实现跑马灯效果

原文:http://www.cnblogs.com/android100/p/android-textview-light.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!