使用短文本字幕时,不会滚动 [英] Marquee won't scroll when using short text

查看:210
本文介绍了使用短文本字幕时,不会滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用选框属性的短文本。我写这篇code:

I want to use the marquee property for short texts. I wrote this code:

<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" >

和它不工作。但是,当我改变了文字为你好你好你好你好你好等等。 (长文本),它的工作原理。如何使用选取框短文本?

and it doesn't work. But when I changed the text as "hello hello hello hello hello etc." (long text) it works. How can I use marquee for short texts?

推荐答案

使用一组宽度。当字符比视图的宽度更长的字幕已启用。

Instead of fill_parent for your layout_width, use a set width. The marquee is enabled when the characters are longer than the View's width.

这篇关于使用短文本字幕时,不会滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆