【Android 开发】TextView的跑马灯效果

来源:互联网 发布:二叉树的结点算法 编辑:程序博客网 时间:2024/06/07 12:41
listview里的TextView跑马灯

步骤1,TextView里:
    android:ellipsize="marquee"
    android:focusableInTouchMode="true"
    android:singleLine="true"
注:TextView一定不能设置focusable="true"

步骤2,ListView里:
     android:focusable="true"

步骤3,绑定的Adapter
    TextView tv = helper.getView(R.id.tv_intro);
    tv.setSelected(true);


纯TextView的跑马灯

 <TextView android:layout_width="100px"
        android:layout_height
="wrap_content"
        android:textColor
="@android:color/white" 
        android:singleLine="true"
        android:ellipsize
="marquee" 
        android:focusable
="true" 
        android:marqueeRepeatLimit
="marquee_forever" 
        android:focusableInTouchMode
="true" 
        android:scrollHorizontally
="true"
        android:text
="这才是真正的文字跑马灯效果"
        
>
    
</TextView>

0 0
原创粉丝点击