我有这样的服装ListView:
Row1 Button1(-) TextView Button2(+)
第2行Button1(-) TextView Button2(+)
Row3 Button1(-) TextView Button2(+)
Row4 Button1(-) TextView Button2(+)
Row5 Button1(-) TextView Button2(+)
当我在任何setOnClickListener
的getView中尝试Button
时,更改了另一行TextView
。
我点击第2行/ Button2(+)
,因此TextView
必须++
(1到2)或点击第2行/ Button1(-)
,TextView
必须{{ 1}}(2比1)但第5行中的--
更改为TextView
或--
。
这是我的适配器
++
答案 0 :(得分:0)
final Holder holder = new Holder();
if (convertView == null) {
convertView = myInflater.inflate(R.layout.list_custom_froot, parent, false);
holder.tv_lbl_name = (TextView)convertView.findViewById(R.id.txt_title) ;
holder.tv_lbl_details = (TextView)convertView.findViewById(R.id.txt_weight );
holder.tv_lbl_price = (TextView)convertView.findViewById(R.id.txt_price) ;
holder.txt = (TextView)convertView.findViewById(R.id.txt_meghda r);
holder.tv_img_pic = (ImageView)convertView.findViewById(R.id.img);
holder.btn2 = (ImageButton)convertView.findViewById(R.id.btn_kam );
holder.btn1 = (ImageButton)convertView.findViewById(R.id.btn_zia d);
holder.btn_more = (ImageButton)convertView.findViewById(R.id.btn_mor e);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
holder.tv_lbl_name.setText ((list.get(position).getname()));
holder.tv_lbl_details.setText ((list.get(position).getdetails()));
holder.tv_lbl_price.setText ((list.get(position).getprice()));
holder.txt ((list.get(position).gettextvalue)); //create the textvalue string in dm_Mive class nd set value empty
holder.btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int butttonpostion = (Integer) buttonView.getTag();
// String v1= holder.txt .gettext();
String v1=list.get(butttonpostion).gettextvalue);// direct get value to list
dm_Mive dm= new dm_Mive()
dm_Mive.settextvalue(v1);
dm_Mive.setname(list.get(buttonpostion).getname())
..
....
friendlist.set(butttonpostion, dm);
}
});