public String listToString(ArrayList<String> stringList){ if (stringList == null) { return null; } StringBuilder result=new StringBuilder(); boolean flag=false; for (String string : stringList) { if (flag) { result.append(","); // 分隔符 }else { flag=true; } result.append(string); } return result.toString(); }
应用场景:
String s1 = listToString(leaders);tv_duty_new.setText(s1);