TextView跑馬燈效果,也就是,自動滾動文字的效果。

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


    >
<TextView  android:id="@+id/tv"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:singleLine="true" 
    android:ellipsize="marquee"
    android:focusable="true"
    android:focusableInTouchMode="true" //這句不能少
    android:marqueeRepeatLimit="marquee_forever"
    android:textColor="#FFFFFF"
    android:text="longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong"
    />

</LinearLayout>

直接複製進佈局文件就OK了。

發佈了25 篇原創文章 · 獲贊 1 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章