android listView 子控件事件错行处理
2012-11-16 15:34:01 来源:WEB开发网break;
case 1:
autoSendLayoutParams = viewHolder.relativeLayout.getLayoutParams();
autoSendLayoutParams.height = 0;
viewHolder.relativeLayout.setLayoutParams(autoSendLayoutParams);
// if(patrolReportBackData != null && changed != false)
// patrolReportBackData.setIsNormal("1");//0是正常1是异常
if(holderDatas.size() > index)
{
holderDatas.get(index).setSpinnerIndex(1);
patrolReportBackDatas.get(index).setIsNormal("1");
}
break;
case 2:
autoSendLayoutParams = viewHolder.relativeLayout.getLayoutParams();
autoSendLayoutParams.height = LayoutParams.WRAP_CONTENT;
viewHolder.relativeLayout.setLayoutParams(autoSendLayoutParams);
// if(patrolReportBackData != null && changed != false)
// patrolReportBackData.setIsNormal("0");//0是正常1是异常
//Log.i("打印出来瞧瞧", String.valueOf(index));
if(holderDatas.size() > index)
{
holderDatas.get(index).setSpinnerIndex(2);
patrolReportBackDatas.get(index).setIsNormal("0");
}
break;
default:
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
viewHolder.disposeDescription.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
if(viewHolder.id.getTag() != null)
{
// if(patrolReportBackData != null && changed != false)
// patrolReportBackData.setFinishDesc(s.toString());
if(holderDatas.size() > index)
{
holderDatas.get(index).setDescription(s.toString());
patrolReportBackDatas.get(index).setFinishDesc(s.toString());
Log.i("文本输入值:", holderDatas.get(index).getDescription());
Log.i("文本输入值Index:", String.valueOf(index));
}
}
//viewHolder.disposeDescription.clearFocus();
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
viewHolder.addPicture.setOnClickListener(new TextView.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
photograph = viewHolder.photograph;
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(Communal.getInstance().setPhotoName(context)));
activity.startActivityForResult(intent, PHOTOHRAPH);
}
});
boolean oldViewData = false;
for (ViewHolderData holderData : holderDatas) {
// if(holderDatas.size() > index)
// Log.i("文本输入值2:", holderDatas.get(position).getDescription());
if(holderData.getPosition() == position)
更多精彩
赞助商链接