<?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 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了。