解决方案 »
- android的3D屏幕翻转中X axis 的含义??
- 求指教The following classes could not be found: - DatePicker
- 哪个高手知道DDMS里面的Heap怎么看
- 获取设备本身手机号
- 来高手写代码,,怎么用ProgressDialog实现请稍后的功能
- SDK Setup.exe 运行问题
- layout文件的疑惑?
- 点击ListPreference控件,会弹出List列表框,如何将这个列表框中的某一项设置为不可用
- ListView的加载问题
- '<>'operator is not allowed for source level below 1.7
- 求过来人指点啊
- Android Relativelayout布局 边缘图片由于空间不够而变形??
this.inflater = LayoutInflater.from(context);
} @Override
public int getCount() {
return zhuihaoPeriods;
} @Override
public Object getItem(int arg0) {
return arg0;
} @Override
public long getItemId(int arg0) {
return arg0;
} @Override
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder holder = new ViewHolder();
view = inflater.inflate(R.layout.listview_zhuihao_issue, null);
holder.etZhuihaoIssueMultiple = (EditText) view
.findViewById(R.id.et_zhuihao_issue_beishu);
holder.tvZhuihaoIssueMoney = (TextView) view
.findViewById(R.id.tv_zhiuhao_issue_money);
holder.cb = (CheckBox) view.findViewById(R.id.cb_zhuihao_issue); holder.cb.setTag(position);
view.setTag(holder); holder.etZhuihaoIssueMultiple.setText(listData.get(position).get(
"beishu"));
holder.tvZhuihaoIssueMoney.setText(listData.get(position).get(
"money")
+ "元");
holder.cb.setText("第" + listData.get(position).get("issue") + "期");
etSelectIssueMultiple = holder.etZhuihaoIssueMultiple; holder.etZhuihaoIssueMultiple
.addTextChangedListener(new TextWatcher() { @Override
public void onTextChanged(CharSequence s, int start,
int before, int count) { } @Override
public void beforeTextChanged(CharSequence s,
int start, int count, int after) { } @Override
public void afterTextChanged(Editable s) {
String currStr = s.toString();
int beishu = -1;
if (currStr == null || "".equals(currStr)) {
beishu = 0;
FuncUtil.showToast(DoubleBallBetActivity.this,
"倍数不能为空!");
} else {
beishu = Integer.valueOf(s.toString()); int indexmoney = Integer.valueOf(holder.cb
.getTag().toString());
zhuihaoIssueMoney = beishu * zhushu * 2;
holder.tvZhuihaoIssueMoney.setText(String
.valueOf(zhuihaoIssueMoney) + "元");
System.out.println("++++++++位置上的money:"
+ indexmoney);
listmoney.remove(indexmoney);
listmoney.add(indexmoney,
String.valueOf(zhuihaoIssueMoney));
listmoneyinit.remove(indexmoney);
listmoneyinit.add(indexmoney,
String.valueOf(zhuihaoIssueMoney));
zhuihaoMoney = 1;
for (int i = 0; i < listmoney.size(); i++) {
zhuihaoMoney = zhuihaoMoney
+ Integer.valueOf(listmoney.get(i));
} zhuihaoMoney = zhuihaoMoney - 1;
tvZhuihaoMoney.setText(zhuihaoMoney + "元"); zhuihaoIssueMoney = 1;
} Editable etable = holder.etZhuihaoIssueMultiple
.getText();
Selection.setSelection(etable, 0); }
}); for (int i = 0; i < listpos.size(); i++) {
if (listpos.get(i) == position) {
holder.cb.setChecked(false);
break;
}
}
holder.cb.setClickable(true);
holder.cb
.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
int pos = Integer.valueOf(buttonView.getTag()
.toString());
System.out.println("pos:" + pos);
String issue = listData.get(pos).get("issue"); if (isChecked) {
int index2 = listpos.indexOf(pos);
listpos.remove(index2);
zhuihaoPeriods = zhuihaoPeriods + 1;
listIssue.remove(pos);
listIssue.add(pos, issue);
System.out.println("listmoneyinit.get(pos)..:"
+ listmoneyinit.get(pos));
listmoney.remove(pos);
listmoney.add(pos, listmoneyinit.get(pos));
} else {
if (listIssue.size() > 0
&& listmoney.size() > 0) {
int index = listIssue.indexOf(issue);
listIssue.remove(index);
listIssue.add(pos, "0"); listmoney.remove(pos);
listmoney.add(pos, "0");
} listpos.add(pos);
zhuihaoPeriods = zhuihaoPeriods - 1;
} adapter.notifyDataSetChanged(); // zhuihaoMoney = 2 * zhushu * zhihaoMultiple
// * zhuihaoPeriods;
// tvZhuihaoMoney.setText(zhuihaoMoney + "元"); zhuihaoMoney = 1;
String listmoneycontext = "";
for (int i = 0; i < listmoney.size(); i++) {
zhuihaoMoney = zhuihaoMoney
+ Integer.valueOf(listmoney.get(i)
.toString());
listmoneycontext = listmoneycontext
+ listmoney.get(i) + "#";
}
System.out.println("listmoneycontext:"
+ listmoneycontext);
zhuihaoMoney = zhuihaoMoney - 1;
tvZhuihaoMoney.setText(zhuihaoMoney + "元");
}
}); return view;
} class ViewHolder {
TextView tvZhuihaoIssueMoney;
EditText etZhuihaoIssueMultiple;
CheckBox cb;
}
}
你看下我的代码 xml文件要贴么 ?
取消了那个cb,哪一行的cb就变成false了
这个... 跟cb成false有什么关系,嘛? 这个是listview少了一行...
但可能也是有点 因为只有在cb=false的时候编辑edittext时 listview少了一行。。具体那里我看了,只是一些增加移除集合里数据的操作,是怎么影响到了adapter?