• JAVA日报


    换汤不换药之家庭记账本app开发(adapter)

    package adapter;

    import android.content.Context;
    import android.util.Log;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.BaseAdapter;
    import android.widget.TextView;

    import com.example.jizhang.R;

    import java.util.List;

    import bean.user;

    public class UserListAdapter extends BaseAdapter {
    private final Context context;
    private final List<user> userList;
    public UserListAdapter(Context context, List<user> userList) {
    this.context=context;
    this.userList=userList;
    }

    @Override
    public int getCount() {
    return userList.size();
    }

    @Override
    public Object getItem(int i) {
    return userList.get(i);
    }

    @Override
    public long getItemId(int i) {
    return 0;
    }

    @Override
    public View getView(int i, View convertView, ViewGroup parent) {
    if(convertView==null){
    convertView=View.inflate(context,R.layout.item_user,null);
    }
    TextView date= convertView.findViewById(R.id.date);
    TextView eat= convertView.findViewById(R.id.eat);
    TextView play= convertView.findViewById(R.id.play);
    TextView clothes= convertView.findViewById(R.id.clothes);
    TextView live= convertView.findViewById(R.id.live);
    TextView usual= convertView.findViewById(R.id.usual);
    date.setText("日期:"+userList.get(i).get("date"));
    eat.setText("食品消费"+userList.get(i).get("eat"));
    play.setText("娱乐消费"+userList.get(i).get("play"));
    clothes.setText("衣物消费"+userList.get(i).get("clothes"));
    live.setText("水电消费"+userList.get(i).get("live"));
    usual.setText("其他消费"+userList.get(i).get("usual"));
    Log.e("position",""+i+userList.get(i).get("eat"));
    return convertView;
    }
    }
  • 相关阅读:
    Oracle
    CCF 201609-5 祭坛
    prometheus同时执行多个查询
    压力测试 Apache ab
    kubernetes reference
    python 深拷贝
    [ argo workflow ]
    django orm 改动数据库中已存在的表(添加、删除、修改表字段)migrations
    内存压力测试命令
    django 未成功初始化自定义表单
  • 原文地址:https://www.cnblogs.com/mumulailai/p/14909755.html
Copyright © 2020-2023  润新知