主要用到的属性为
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
案列代码:main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- TextView需要设置焦点 在触摸模式下拿到焦点-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="好好写代码好好写代码好好写代码好好写代码好好写代码好好写代码好好写代码好好写代码好好写代码"
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
/>
</LinearLayout>