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

android listView 子控件事件错行处理

 2012-11-16 15:34:01 来源:WEB开发网   
核心提示:if(event.getAction() == MotionEvent.ACTION_UP) {index= Integer.parseInt(view.getTag().toString());//patrolReportBackData = patrolReportBackDatas.get(index);}ret


if(event.getAction() == MotionEvent.ACTION_UP) {


index= Integer.parseInt(view.getTag().toString());
//patrolReportBackData = patrolReportBackDatas.get(index);
}
return false;
}
});

viewHolder.disposeDescription.clearFocus();


if(index!= -1 && index == position) {


// 如果当前的行下标和点击事件中保存的index一致,手动为EditText设置焦点。


viewHolder.disposeDescription.requestFocus();


}


convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
changed = false;
viewHolder.id.setText("");
viewHolder.id.setTag(null);
viewHolder.spinner.setSelection(0);
/**************************************/
// boolean isNewSpinner = false;
// for (ViewHolderData holderData : holderDatas) {
// if(holderData.getPosition() == position)
// {
// viewHolder.spinner.setSelection(holderData.getSpinnerIndex());
// isNewSpinner = true;
// }
// }
//
// if(isNewSpinner)
// viewHolder.spinner.setSelection(0);
/**************************************/
viewHolder.disposeDescription.setText("");
bitPhoto = "";
imageItem = new ArrayList<HashMap<String,Object>>();
ImageAdapter adapter = new ImageAdapter(imageItem,context);
viewHolder.photograph.setAdapter(adapter);
changed = true;

viewHolder.spinner.setTag(position);
viewHolder.disposeDescription.setTag(position);
viewHolder.addPicture.setTag(position);
viewHolder.photograph.setTag(position);
}


if(list != null)
{
TaskTemplateDetail taskTemplateDetail = list.get(position);
viewHolder.name.setText(taskTemplateDetail.getCheckItem());
viewHolder.id.setText(taskTemplateDetail.getCheckTemplateItemId());
viewHolder.id.setTag(taskTemplateDetail);

String whether_anomaly = Communal.getInstance().getStirng(context,R.string.whether_anomaly);//是否异常
setSpinnerValue(whether_anomaly.split(","),viewHolder.spinner,"是否异常");
viewHolder.spinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {

@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
// long selected=arg0.getItemIdAtPosition(arg2);


ViewGroup.LayoutParams autoSendLayoutParams = null;
switch (arg2) {
case 0:
autoSendLayoutParams = viewHolder.relativeLayout.getLayoutParams();
autoSendLayoutParams.height = 0;
viewHolder.relativeLayout.setLayoutParams(autoSendLayoutParams);

// if(patrolReportBackData != null && changed != false)
// patrolReportBackData.setIsNormal("");//0是正常1是异常

if(holderDatas.size() > index)
{
holderDatas.get(index).setSpinnerIndex(0);
patrolReportBackDatas.get(index).setIsNormal("");

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

Tags:android listView 控件

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