Java 如何在android中以表格格式显示ArrayList数据
我在将数据显示到各个字段时遇到问题 我喜欢arraylist数据库中的数据Java 如何在android中以表格格式显示ArrayList数据,java,android,arraylist,Java,Android,Arraylist,我在将数据显示到各个字段时遇到问题 我喜欢arraylist数据库中的数据 ArrayList<String> ar= new ArrayList<String>; 这里的第一个元素是id,其他元素是ara值。像India-EditText字段和整数1,2,3是单选按钮 India 1(checked first radio button) India 3(checked third radio button) Australia
ArrayList<String> ar= new ArrayList<String>;
这里的第一个元素是id,其他元素是ara值。像India-EditText字段和整数1,2,3是单选按钮
India 1(checked first radio button)
India 3(checked third radio button)
Australia 1(Checked first radio button)
Germany 2(Checked second radio button)
我已经尝试了很多时间,但可以得到适当的解决方案,所以请更新一些显示这些数据的技巧
我想以表格的形式显示这样的数据
我所做的
在这里,如果我将数据放在静态的first列表中,那么效果很好,但是如何将ar列表数据放在first列表中。看看-class。看看ArrayAdapter,它允许您在ListView中显示数据。假设您指的是控制台的输出,您可以单步浏览列表,并使用制表符分隔显示其项目
//As an example of usage, not a solution using your structures
for (MyObject o : ar)
{
System.out.println(o.getCountry() + "\t" + o.getValue())
}
List<EditText> listET = new ArrayList<EditText>();
ArrayList<String> first= new ArrayList<String>();
if(edittextfield){
first.add("India");first.add("USA");first.add("Australia");first.add("Germany");
EditText et_text_input = new EditText(getContext());
for(int p=0;p<listET.size()+1;p++){
et_text_input.setText(first.get(p));
listET.add(et_text_input);
ll.addView(et_text_input);
}
}else if(radiobuttonfield){
what to do in radiobutton.
}
//As an example of usage, not a solution using your structures
for (MyObject o : ar)
{
System.out.println(o.getCountry() + "\t" + o.getValue())
}