无法将现有文本视图从xml设置为textview数组

时间:2012-01-12 06:16:28

标签: android textview

我的Xml文件中有2个TextView,我在TextView数组中设置了它们。我如何根据索引访问它们。

请帮我解决这个问题。

1 个答案:

答案 0 :(得分:2)

Textview a,s,d,f,g,h;
intialize all;
TextView[] text_arrays;

text_array = new TextView[]{a,s,d,f,g,h};

现在做你想做的事情

text_array[0].setText("Text View One);
text_array[1].setText("Text View two);
text_array[5].setText("Text View six);