[英]android Java how can I add new textline from TextView
I have a TextView. 我有一个TextView。 and firstly I set a line via for loop.
首先,我通过for循环设置一条线。 array[0], array [1]... at the first time textView has "work", and then I want to add "is", "a" like these strings.
array [0],array [1] ...第一次,textView具有“ work”,然后我想像这些字符串一样添加“ is”,“ a”。 However, each time old line deleted and set new line!!!
但是,每次删除旧行并设置新行!!!
inputs2 = inputs.getText().toString();
String[] words = inputs2.split(",");
int n= words.length;
for(int i=0;i<n;i++){
resultView.setText(words[i]);
}
How can I add new textline without deleted old one. 如何在不删除旧文本行的情况下添加新文本行。 Thanks.
谢谢。
To append String values to a TextView, you can use the append()
method: 要将String值附加到TextView,可以使用
append()
方法:
String [] array;
TextView textView;
for (int i = 0; i < array.length; i++) {
textView.append(array[i]);
}
您可以使用\\ n \\ r的append方法添加新行
resultView.append(words[i]+"\n\r");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.