单击我的自定义列表视图项时,我想打开一个自定义对话框()。
我试过了,但无法打开对话框。这是代码详细信息:
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.input_dialog);
dialog.setTitle("What about Today!");
**//initialize custom dialog items.**
EditText mood = (EditText) dialog.findViewById(R.id.editTextyourMode);
Button btnSaveButton = (Button) dialog
.findViewById(R.id.btnSaveMyMoods);
Button btnClear = (Button) dialog
.findViewById(R.id.btnClear);
dialog.show();
}
这是自定义数组适配器 getView(...) 方法。
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.sell_info_list, parent, false);
TextView product_id = (TextView) rowView.findViewById(R.id.product_id);//
product_id.setText(products.get(position).getProduct_id());
EditText product_quantity = (EditText) rowView
.findViewById(R.id.editTextQuantity);
return rowView;
}
最后,我想在单击列表视图项编辑文本时打开此对话框。有人帮我吗?