`
zhangle2612
  • 浏览: 23357 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

android走马灯效果

阅读更多
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
   
    <Button
        android:layout_width="150dip"
        android:layout_height="wrap_content"
        android:text="@string/marquee_default"
        android:singleLine="true"
        android:ellipsize="marquee"/>
       
    <Button
        android:layout_width="150dip"
        android:layout_height="wrap_content"
        android:text="@string/marquee_once"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit="1"/>
       
    <Button
        android:layout_width="150dip"
        android:layout_height="wrap_content"
        android:text="@string/marquee_forever"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit="marquee_forever"/> 
          
</LinearLayout>

上述配置文件中有三个Button,当任何一个Button获得焦点的时候都会出现走马灯的效果,
而其中marqueeRepeatLimit的设置决定了走马灯将会走几圈
第一个Button没有设置这个参数,则是默认的三圈,走过三遍之后,Button上的text就停止了
第二个Button设置了为1,则只会走一圈,就停止了
最后一个Button则会永远的是循环走马灯的效果。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics