---
title: "TextView跑马灯效果"
author: "KT.G"
date: "2015-01-04T17:28:53Z"
tags: ["跑马灯"]
categories: ["移动开发"]
slug: "textview"
draft: false
lastmod: "2015-01-04T17:28:53Z"
id: 2172469
url: "https://kt-g.iteye.com/blog/2172469"
---

```
 <TextView android:layout_width="100px"
        android:layout_height="wrap_content"
        android:textColor="@android:color/white" 
        android:ellipsize="marquee" 
        android:focusable="true" 
        android:marqueeRepeatLimit="marquee_forever" 
        android:focusableInTouchMode="true" 
        android:scrollHorizontally="true"
        android:text="滚呀跑马灯，滚呀跑马灯"
        >
    </TextView>
```

  代码说明：

  1）设置android:focusableInTouchMode 设置跑马灯效果

   2）android:scrollHorizontally="true" 设置横向滑动