JAVA日报
Posted 我的未来姓栗山
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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;
}
}
以上是关于JAVA日报的主要内容,如果未能解决你的问题,请参考以下文章