在布局文件里就可以实现:
<TextView
android:id="@+id/text_id"
android:layout_marginLeft="100dp"
android:layout_marginRight="100dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world"
//重要的是以下的程序
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:marqueeRepeatLimit="marquee_forever"
android:focusableInTouchMode="true"
/>