zoukankan      html  css  js  c++  java
  • 个人冲刺--账本四

    CostListAdapter.java

    复制代码
    package com.example.jizhangben;
            import android.content.Context;
            import android.view.LayoutInflater;
            import android.view.View;
            import android.view.ViewGroup;
            import android.widget.BaseAdapter;
            import android.widget.TextView;
    
            import java.util.List;
    
    /**
     * Created by 惠普 on 2021/2/18.
     */
    
    public class CostListAdapter extends BaseAdapter {
    
        private List<CostBean> mList;
        private Context mContext;
        private LayoutInflater mLayoutInflater;
    
        public CostListAdapter(Context context,List<CostBean> list){
            mContext=context;
            mList=list;
            mLayoutInflater=LayoutInflater.from(context);
        }
        @Override
        public int getCount() {
            return mList.size();
        }
    
        @Override
        public Object getItem(int position) {
            return mList.get(position);
        }
    
        @Override
        public long getItemId(int position) {
            return position;
        }
    
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder viewHolder;
            if(convertView==null){
                viewHolder=new ViewHolder();
                convertView=mLayoutInflater.inflate(R.layout.list_item,null);
                viewHolder.mTvCostTitle=(TextView)convertView.findViewById(R.id.tv_title);
                viewHolder.mTvCostDate=(TextView)convertView.findViewById(R.id.tv_date);
                viewHolder.mTvCostMoney=(TextView)convertView.findViewById(R.id.tv_cost);
                convertView.setTag(viewHolder);
            }else{
                viewHolder= (ViewHolder) convertView.getTag();
            }
            CostBean bean=mList.get(position);
            viewHolder.mTvCostTitle.setText(bean.CostTitle);
            viewHolder.mTvCostDate.setText(bean.CostDate);
            viewHolder.mTvCostMoney.setText(bean.CostMoney);
            return convertView;
        }
    
        private static class ViewHolder{
            public TextView mTvCostTitle;
            public TextView mTvCostDate;
            public TextView mTvCostMoney;
        }
    复制代码
  • 相关阅读:
    数据集冲突
    苹果如何设计iPad的商业模式
    IT部门应如何制定技术路线图
    关于软件测试
    c#写文件
    正则表达式语法及常用表达式。
    使用Mysql的Replication功能实现数据库同步
    CMMI=大象关冰箱?
    asp.net 中RegularExpressionValidator的bug|IE的bug?
    Singleton 模式的Java和C#的实现方法
  • 原文地址:https://www.cnblogs.com/zhaoyuxiao000/p/14908665.html
Copyright © 2011-2022 走看看