StockQueryAdapter
作者:互联网
package com.example.wms;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.wms.entity.StockEntityQuery_data;
import com.example.wms.entity.StockQueryEntity;
import java.util.LinkedList;
public class StockQueryAdapter extends BaseAdapter {
private LinkedList<StockEntityQuery_data> mData;
private Context mContext;
public StockQueryAdapter(LinkedList<StockEntityQuery_data> mData, Context mContext) {
this.mData = mData;
this.mContext = mContext;
}
@Override
public int getCount() {
return mData.size();
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return position;
}
//写实体类 自定义展示界面 数据转换
@Override
public View getView(int position, View convertView, ViewGroup parent) {
try{
ViewHolder holder=null;
if(convertView==null){
convertView = LayoutInflater.from(mContext).inflate(R.layout.iteminput,parent,false);
holder=new ViewHolder();
holder.imgOut=(ImageView)convertView.findViewById(R.id.imgOut);
holder.value1=(TextView)convertView.findViewById(R.id.value1);
holder.value2=(TextView)convertView.findViewById(R.id.value2);
holder.value3=(TextView)convertView.findViewById(R.id.value3);
convertView.setTag(holder);
}else{
holder=(ViewHolder)convertView.getTag();
}
holder.imgOut.setBackgroundResource(R.drawable.giftbox);
int surplus=mData.get(position).getQty()-(int)mData.get(position).getTrayQty();
String valueDataUp="物料条码:"+mData.get(position).getMatBarCode()+" 数量:"+mData.get(position).getQty();
holder.value1.setText(valueDataUp);
String valueDataCenter="剩余数量:"+surplus+" 物料类型:"+mData.get(position).getMatType()
+" 物料规格:"+mData.get(position).getMatSpec();
holder.value2.setText(valueDataCenter);
String valueDataDown="组盘数量:"+mData.get(position).getTrayQty()+" 尾单标识:"+mData.get(position).getFinalFlag()
+" 工序信息:"+mData.get(position).getOpration();
holder.value3.setText(valueDataDown);
//mData.get(position).getItemName()
// int qty=mData.get(position).getQty();
}catch (Exception e){
e.printStackTrace();
}
return convertView;
}
static class ViewHolder{
ImageView imgOut;
TextView value1;
TextView value2;
TextView value3;
}
}
标签:mData,get,convertView,import,position,StockQueryAdapter,holder 来源: https://www.cnblogs.com/changanyi/p/16377991.html