• 家庭记账本(五)


    delete_cost_data.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="match_parent"
        android:gravity="center"
        android:layout_height="match_parent">
    
    
        <EditText
            android:id="@+id/et_cost_title"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="4dp"
            android:hint="请输入要删除的Cost Title"/>
    
    </LinearLayout>

    CostListAdapter.java

    package com.example.family;
    
    import android.content.Context;
    import android.graphics.ColorSpace;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.BaseAdapter;
    import android.widget.Button;
    import android.widget.TextView;
    
    import java.util.List;
    
    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() {
            System.out.println(mList.size());
            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(final 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;
        }
    }
  • 相关阅读:
    散户如何战胜专业投资机构
    机器学习总结
    进程线程及堆栈关系的总结
    线程堆栈是如何增长的
    Ubuntu下CodeBlocks控制台程序中文显示乱码解决问题
    jdk 安装
    python文件运行报错:Error: Please select a valid Python interpreter
    python 解释器安装
    allure在pycharm下运行出现以下乱码的提示 解决方案
    pytest 测试环境框架搭建
  • 原文地址:https://www.cnblogs.com/wangdayang/p/14913963.html
Copyright © 2020-2023  润新知