简单的Andr​​oid滚动文字北京时间 [英] Simple Android Scrolling Text Ticker

查看:112
本文介绍了简单的Andr​​oid滚动文字北京时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建一个滚动文本股票为一个简单的Andr​​oid应用程序。

I want to create a scrolling text ticker for a simple android app.

我有存储在数组中的报价大名单,我想随机填充我的股票的行情:一是报价卷轴一路过关斩将,然后又是随机选取的,并通过滚动的方式,等等。

I have a large list of quotes stored in an array, and I would like to randomly populate my ticker with the quotes: one quote scrolls all the way through, then another is randomly chosen and scrolls its way through, and so on.

该股票应该沿着突突不管什么都集中在或上空盘旋......

The ticker should chug along regardless of what's been focused on or hovered over...

1)如何创​​建一个文本股票为这些目的?

1) How do I create a text ticker for these purposes?

2)我如何填充随机报价从我的阵列中选择一个源源不断的股票?

2) How do I populate the ticker with a steady stream of random quotes selected from my array?

感谢

推荐答案

如果我理解你正在试图做正确的东西你想看看 ellipsize marqueeRepeatLimit 的TextView 的属性。

If I'm understand what you're trying to do properly you want to look at the ellipsize and marqueeRepeatLimit properties of TextView.

通过API:

<一个href="http://developer.android.com/reference/android/widget/TextView.html#attr_android:ellipsize">http://developer.android.com/reference/android/widget/TextView.html#attr_android:ellipsize

<一个href="http://developer.android.com/reference/android/widget/TextView.html#attr_android:marqueeRepeatLimit">http://developer.android.com/reference/android/widget/TextView.html#attr_android:marqueeRepeatLimit

另外,看看这个问题一个实现。从我记得,当我不得不实施这样的事情是,XML属性可能会非常棘手。他们彼此干扰和prevent来自全国各地的屏幕上滚动的文字,因此可能需要一些与玩弄得到它的权利。

Also, look at this question for an implementation. From what I remember when I had to implement something like this is that the XML properties can be tricky. They interfere with one another and prevent the text from scrolling across the screen so it may take some toying with to get it right.

在这里,有不同的报价填充它很简单,只要调用的setText()的TextView 的随机的报价,我认为你必须存储在在适当的时候数组或数据库。

From there, populating it with different quotes is as simple as calling setText() on the TextView with the random quote that I assume you'll have stored in an array or database at the proper time.

这篇关于简单的Andr​​oid滚动文字北京时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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