Android的跑马灯 [英] Android Marquee

查看:99
本文介绍了Android的跑马灯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有工作的例子跑马灯在Android的?我通过一些网站去了,但这样的例子是行不通的。

感谢您的答案。但下面的code不工作呢。我使用的是Android 2.2。

 <的TextView
             机器人:单线=真
             机器人:ellipsize =金字招牌
             机器人:marqueeRepeatLimit =marquee_forever
             机器人:文本=跑马灯../>
 

解决方案

很容易通过XML做。使用以下设置:

 安卓SINGLELINE =真
机器人:ellipsize =金字招牌
机器人:marqueeRepeatLimit =marquee_forever
机器人:可聚焦=假
机器人:scrollHorizo​​ntally =真
 

如果您的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屋!

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