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

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>

 

posted @ 2017-02-17 15:24  leafseelight  阅读(277)  评论(0)    收藏  举报