在android系统TextView的滚动系统、android、TextView

2023-09-07 23:45:27 作者:孤女无爱

在我的应用程序必须实现一个自动滚动的TextView,我提到此链接。

In my application i have to implement an automatically scrolling textview, I referred this link .

现在我已经按照我的要求滚动tetxview.But是,我有一个字符串数组(我已经解析和我有一些字符串)..考虑阵列可能是

Now I have a scrolling tetxview.But according to my requirement is that I have a string array(I have parsed and I have some string)..Consider the array may be

 string[] array=new string{"fgsdfd","gdfghdjhsd","gdfjhsgfhds"};

现在我想(这将自动滚动)。

Now i want this array to be displayed in that textview(which will scroll automatically).

我想是这样的:

 fgsdfd   gdfghdjhsd    gdfjhsgfhds------------------>this will scroll automatically

这是我的TextView(滚动):

This is my textview(scrolling):

 <TextView
    android:text="Really Long Scrolling Text Goes Here.... ..... ............ .... ...."
    android:singleLine="true"
    android:ellipsize="marquee"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:id="@+id/TextView03"
    android:padding="5dip" 
    android:layout_width="wrap_content" 
    android:textColor="#000000"
    android:layout_height="wrap_content" />

如何设置字符串数组到tetxview..Please帮助我。

How can I set an array of string to a tetxview..Please help me.

推荐答案

尝试使用StringBuilder的。

Try using StringBuilder.

String[] array = { "fgsdfd", "gdfghdjhsd", "gdfjhsgfhds" };
StringBuilder sb = new StringBuilder();

for (int i = 0; i < array.length; i++) {
    sb.append(array[i]);
}
txtView.setText(sb.toString());
 
精彩推荐
图片推荐