Android的跑马灯 [英] Android Marquee
问题描述
有没有工作的例子跑马灯在Android的?我通过一些网站去了,但这样的例子是行不通的。
感谢您的答案。但下面的code不工作呢。我使用的是Android 2.2。
<的TextView
机器人:单线=真
机器人:ellipsize =金字招牌
机器人:marqueeRepeatLimit =marquee_forever
机器人:文本=跑马灯../>
很容易通过XML做。使用以下设置:
安卓SINGLELINE =真
机器人:ellipsize =金字招牌
机器人:marqueeRepeatLimit =marquee_forever
机器人:可聚焦=假
机器人:scrollHorizontally =真
如果您的TextView的是一个RelativeLayout的内,宽度或高度将必须是静态的(即32dp)。如果你需要动态的,将TextView的在RelativeLayout的内的另一景观。
在的onCreate(),您需要选择的TextView的:
myTextView.setSelected(真正的);
Is there any working example for Marquee in android? I went through some sites, but that examples are not working.
Thank you for the answers.. But the following code is not working anyway. I am using Android 2.2.
<TextView
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:text="Marquee.."/>
it's easy to do via XML. Use the following settings:
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="false"
android:scrollHorizontally="true"
If your TextView is within a RelativeLayout, the width or height will have to be static (i.e. 32dp). If you need dynamic, place the TextView in another View within the RelativeLayout.
In onCreate(), you need to make the TextView selected:
myTextView.setSelected(true);
这篇关于Android的跑马灯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!