WEB开发网
开发学院手机开发Android 开发 android listView 子控件事件错行处理 阅读

android listView 子控件事件错行处理

 2012-11-16 15:34:01 来源:WEB开发网   
核心提示:ViewHolderData viewHolderData = new ViewHolderData();viewHolderData.setPosition(i);if(isNormal.equals("0"))viewHolderData.setSpinnerIndex(2);else if(i
ViewHolderData viewHolderData = new ViewHolderData();
viewHolderData.setPosition(i);
if(isNormal.equals("0"))
viewHolderData.setSpinnerIndex(2);
else if(isNormal.equals("1"))
viewHolderData.setSpinnerIndex(1);

viewHolderData.setDescription(patrolReportBackDatas.get(i).getFinishDesc());
viewHolderData.setStrBitPhoto(bitPhoto);

if(bitPhoto != null)
{
imageItem = new ArrayList<HashMap<String, Object>>();
String[] strImage = bitPhoto.split(",");
for (String string : strImage) {
if(!string.equals(""))
{
Communal.getInstance().saveImage(context, string);
String imagepath = Environment.getExternalStorageDirectory() + "/MOMSPHOTO/" + Communal.getInstance().getImageName();
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inJustDecodeBounds = true ;
BitmapFactory.decodeFile(imagepath, opts);
opts.inSampleSize = computeSampleSize(opts, - 1 , 80 * 80 );
opts.inJustDecodeBounds = false ;
try {
Bitmap bmp = BitmapFactory.decodeFile(imagepath, opts);
HashMap<String, Object> hashmap = new HashMap<String, Object>();
hashmap.put("ItemImage", bmp);//添加图像资源的ID
hashmap.put("ItemText", Communal.getInstance().getImageName());//按序号做ItemText
imageItem.add(hashmap);

} catch (OutOfMemoryError err) {

}
}
}

viewHolderData.setImageList(imageItem);
}

holderDatas.add(viewHolderData);
}
}

}

@Override
public int getCount() {
// TODO Auto-generated method stub
return list.size();
}


@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return list.get(arg0);
}


@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}


//private List<ViewHolder> holder = new ArrayList<ViewHolder>();
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
Log.i("索引值:", String.valueOf(position));
//final PatrolReportBackData patrolReportBackData = patrolReportBackDatas.get(position);
// viewIndex = position;
index = position;

final ViewHolder viewHolder;
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_list_patrol, null);
viewHolder = new ViewHolder();
viewHolder.id = (TextView)convertView.findViewById(R.id.item_patrol_id_textView);
viewHolder.name = (TextView)convertView.findViewById(R.id.item_patrol_name_textView);
viewHolder.spinner = (Spinner)convertView.findViewById(R.id.item_patrol_whetherAnomaly);
viewHolder.relativeLayout = (RelativeLayout)convertView.findViewById(R.id.item_relativeLayout_patrol_description);
viewHolder.disposeDescription = (EditText)convertView.findViewById(R.id.item_patrol_disposeDescription);

上一页  1 2 3 4 5 6 7 8  下一页

Tags:android listView 控件

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接