水平滚动多个文字浏览
问题描述:
在我的应用程序中,我必须实现自动滚动多个文字浏览。 现在我有一个根据我的要求滚动tetxview.But是,我有一个字符串数组(我已经解析了,我有一些字符串)..考虑该阵列可以水平滚动多个文字浏览
string[] array = new string {"abc123", "123abc", "xyz123"};
现在我想这个数组将显示在该文本视图中(将自动滚动)。
我希望它是这样的:
abc123 123abc xyz123------------------>this will scroll automatically but one by one or one after another
这是我的TextView(滚动):
<TextView
android:text="Really Long Scrolling Text"
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" />
编程方式我这样做:
String[] array
= getResources().getStringArray(R.array.scrolling_banner_array);
StringBuilder sb = new StringBuilder();
for (String anArray : array) {
sb.append(" ").append(anArray);
}
text.setText(sb.toString());
现在阵列不断滚动但我希望一次滚动一个文本,在完成一个文本后应该出现另一个文本。
请帮帮我。
答
尝试使用GridView中的项目数为1并滚动垂直方向并启用滚动条。
希望它可以工作!