2012-03-03 74 views
2

我想为短文本使用滚动字幕属性。我写了这段代码:使用短文本时,滚动字幕不会滚动

<TextView 
     android:id="@+id/MarqueeText" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:ellipsize="marquee" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:freezesText="true" 
     android:marqueeRepeatLimit="marquee_forever" 
     android:paddingLeft="15dip" 
     android:paddingRight="15dip" 
     android:scrollHorizontally="true" 
     android:singleLine="true" 
     android:text="Hello" > 

它不起作用。但是当我将文字改为“你好,你好,你好,你好,你好,等等。” (长文本)它的作品。我怎样才能使用选取框短文本?

回答

6

而不是fill_parent为您的layout_width,使用设置宽度。当字符长度超过视图宽度时,选框会启用。

+0

非常感谢你,你救了我! – 2012-03-04 17:49:04

+0

不客气。请记住标记我的答案为已接受。 :) – 2012-03-04 21:00:35

+1

这对我没有任何影响。 – Leon 2015-12-03 12:00:29