让TextView出现跑马灯效果

只需要在TextView中添加一些属性即可:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <!-- 实现的属性:ellipsize、focusable、focusableInTouchMode、singleLine -->
    
    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="20dp"
        android:textColor="#9C27B0"
        android:ellipsize="marquee"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:singleLine="true"
        android:gravity="center"
        android:text="www.cnblogs.com/zzw1994  www.cnblogs.com/zzw1994"
        android:textSize="30sp" />

</LinearLayout>

 

posted on 2015-12-05 11:17  Z2  阅读(376)  评论(0编辑  收藏  举报

导航