代码改变世界

4月20号作业

2017-05-02 21:03  做作业呀  阅读(181)  评论(0编辑  收藏  举报

布局文件

<ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/list"
        android:scrollbars="vertical"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/List1"
            android:text="@string/name"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/List2"
            android:text="@string/age"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/List3"
            android:text="@string/mail"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/List4"
            android:text="@string/address"/>

  java文件

private String name;
    private String age;
    private String mail;
    private String address;

public InfoClass(String name, String age, String mail, String address) {
        this.name = name;
        this.age = age;
        this.mail = mail;
        this.address = address;

public String getName() {
        return name;
    }

    public String getAge() {
        return age;
    }

    public String getMail() {
        return mail;
    }

    public String getAddess() {
        return address;
    }

datas.add(new Classinfo("姓名:吴林威,"年龄:20","邮箱:111.com","地址:河南"));

datas.add(new Classinfo("姓名:吴国栋","年龄:20","邮箱:222.com","地址:温州"));
     
datas.add(new Classinfo("姓名:周沙沙","年龄:20","邮箱:333.com","地址:安徽"));
datas.add(new Classinfo("姓名:王浩","年龄:21","邮箱:444.com","地址:安徽"));
datas.add(new Classinfo("姓名:尹钊","年龄:25","邮箱:555.com","地址:四川"));