Android 使用多维ArrayList填充ListView

Android 使用多维ArrayList填充ListView,android,Android,我正在尝试填充ListView,如中所示 它工作正常(见下面的代码) //字符串数组。。。 String[]mobileArray={“Android”、“IPhone”、“WindowsMobile”、“黑莓”、“WebOS”、“Ubuntu”、“Windows7”、“Max OS X”} 事实上,学生有三排。。。但没有像e3c94gh这样的值 请帮助我以最小的代码更改完成这项工作-我的意思是- 我的目标是用学生取代mobileArray(代码更改最少) ArrayList填充代码如下: Li

我正在尝试填充ListView,如中所示 它工作正常(见下面的代码)

//字符串数组。。。 String[]mobileArray={“Android”、“IPhone”、“WindowsMobile”、“黑莓”、“WebOS”、“Ubuntu”、“Windows7”、“Max OS X”}

事实上,学生有三排。。。但没有像e3c94gh这样的值

请帮助我以最小的代码更改完成这项工作-我的意思是-

我的目标是用学生取代mobileArray(代码更改最少)

ArrayList填充代码如下:
List Students=new ArrayList();
学生1=新学生();
学生1.设置学生姓名(“学生1”);
学生1.设置学生编号(“N0001”);
学生1.设置电子邮件(“student1@student.com");
学生1.学年(1991年);
学生。添加(学生1);
学生2=新学生();
学生2.设置学生姓名(“学生2”);
学生2.设置学生编号(“N0002”);
学生2.设置电子邮件(“student2@student.com");
学生2.学年(1992年);
学生。添加(学生2);
学生3=新学生();
学生3.设置学生姓名(“学生3”);
学生3.设置学生编号(“N0003”);
学生3.设置电子邮件(“student3@student.com");
学生3.学年(1993年);
学生。添加(学生3);
它应该是:

ArrayAdapter<Student> adapter = new ArrayAdapter<Student>(this, R.layout.activity_listview,Students);
ArrayAdapter adapter=新的ArrayAdapter(this,R.layout.activity\u listview,Students);

您的学生阵列列表在哪里?

应用更改阵列适应程序。没有任何变化。我还将使用ArrayList填充步骤进行更新,以更改“R.layout.activity\u listview”===>>>“android.R.layout.simple\u list\u item\u 1”如果要在一行listview中显示多个信息,必须对其进行自定义。您需要从以下几点开始:
ArrayAdapter adapter = new ArrayAdapter<Student>(this, R.layout.activity_listview,Students);

        ListView listView = (ListView) findViewById(R.id.listView);
        listView.setAdapter(adapter);
abc.mycom.com.collectionsample.Students@e3c94gh
abc.mycom.com.collectionsample.Students@erdgdhdf
abc.mycom.com.collectionsample.Students@eyfgbgfb
ArrayList population code is here:

 List<Student> Students = new ArrayList();


        Student student1 = new Student();

        student1.setStudentName("student 1");
        student1.setStudentNo("N0001");
        student1.setEmail("student1@student.com");
        student1.setYear(1991);

        Students.add(student1);


        Student student2 = new Student();

        student2.setStudentName("Student 2");
        student2.setStudentNo("N0002");
        student2.setEmail("student2@student.com");
        student2.setYear(1992);

        Students.add(student2);


        Student student3 = new Student();

        student3.setStudentName("Student 3");
        student3.setStudentNo("N0003");
        student3.setEmail("student3@student.com");
        student3.setYear(1993);

        Students.add(student3);
ArrayAdapter<Student> adapter = new ArrayAdapter<Student>(this, R.layout.activity_listview,Students);