简单的Andr​​oid滚动文字北京时间北京时间、文字、简单、oid

由网友(我对你的爱是蒸的i)分享简介:我要创建一个滚动文本股票为一个简单的Andr​​oid应用程序。 I want to create a scrolling text ticker for a simple android app. 我有存储在数组中的报价大名单,我想随机填充我的股票的行情:一是报价卷轴一路过关斩将,然后又是随机选取的,并通过滚动的...

我要创建一个滚动文本股票为一个简单的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:

http://developer.android.com/reference/android/widget/TextView.html#attr_android:ellipsize

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.

阅读全文

相关推荐

最新文章