如何通過該標記將父列表項標記爲子列表如果我選擇子項必須禁用父列表項。請幫助我新的android。如何將父列表項標記到子列表中
活動:
這是我的活動在這裏我對父列表項單擊我會與孩子列表對話框。
listView1.setAdapter(adapter);
adapter.notifyDataSetChanged();
listView1.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
newListitems2.clear();
newListitems2.addAll(itemsList1);
// ArrayList newListitems2 = new ArrayList();
//newListitems2.add(itemsList1);
dialog = new Dialog(PendingOrdersActitvity.this);
dialog.setContentView(R.layout.itembumping);
dialog.show();
listView1.setTag(position);
list1 = (ListView) dialog.findViewById(R.id.list1);
ItemBumpingAdapter adapter2 = new ItemBumpingAdapter(PendingOrdersActitvity.this, newListitems2);
list1.setAdapter(adapter2);
Button okButton = (Button) dialog.findViewById(R.id.ok1);
okButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
Button cancelButton = (Button) dialog.findViewById(R.id.Cancel1);
cancelButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
return true;
}
});
父列表適配器:
其中父列表負載
兒童適配器:
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
String item = null, qty = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = inflator.inflate(R.layout.itembumpingadapter, null);
holder.qty = (TextView) convertView.findViewById(R.id.qty);
holder.name = (TextView) convertView.findViewById(R.id.item);
holder.childText = (TextView) convertView
.findViewById(R.id.childitem);
holder.qtyChild = (TextView) convertView
.findViewById(R.id.qtychild);
holder.checkbox = (CheckBox) convertView.findViewById(R.id.chckbox1);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
parentobjid = newListitems.get(position).getParentobjectid();
if (!parentobjid.isEmpty()) {
holder.name.setText(" " + newListitems.get(position).getItemnNameDisplay());
holder.name.setTextColor(Color.parseColor("#CC0000"));
holder.qty.setText(" " + String.valueOf(newListitems.get(position)
.getQuantityDisplay()));
holder.qty.setTextColor(Color.parseColor("#CC0000"));
} else {
holder.name.setText(newListitems.get(position).getItemnNameDisplay());
holder.qty.setText(String.valueOf(newListitems.get(position)
.getQuantityDisplay()));
holder.name.setTextColor(Color.parseColor("#FFFFFF"));
holder.qty.setTextColor(Color.parseColor("#FFFFFF"));
holder.checkbox.setChecked(false);
holder.checkbox.setTag(position);
holder.checkbox.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
int pos = (Integer) v.getTag();
newListitems.get(pos).setChecked(!newListitems.get(pos).isChecked());
}
});
if (newListitems.get(position).isChecked()) {
holder.name.setEnabled(true);
holder.name.setBackgroundColor(Color.parseColor("#DCDBDB"));
} else {
holder.name.setEnabled(false);
}
}
return convertView;
}
找到孩子的父母並將其禁用 – mismanc
我的問題是,只有通過單擊子元\ – mallika
才能找到父母,所以我怎麼才能理解您使用這個問題的小工具。你看現在爲什麼你得到downvotes?..看孩子的DNA或編輯的問題,並提供更多的信息 – mismanc