我有一个butoon,在点击这个按钮,我想开在一个AlertDialog这样的多个按钮:
I have a butoon, on clicking of this button i want to open multiple buttons on a single AlertDialog like this :
给我一个帮助:
我就是用这个....添加多个按钮 alertDialog.setButton(删除,删除,新OnClickListener(){
I was using this.... to add multiple buttons alertDialog.setButton(delete, "Delete", new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
但我发现...,改变SET按钮()来setButton2()..像.....重量xcan我做这个......
but I found..., change setButton() to setButton2().. something like..... wt xcan i do for this....
我会膨胀AlertDialog用我自己的自定义视图(my_alert_dialog.xml)。
I would inflate the AlertDialog with my own custom view (my_alert_dialog.xml).
AlertDialog.Builder alert = new AlertDialog.Builder(this);
LayoutInflater inflater = getLayoutInflater();
//inflate view for alertdialog since we are using multiple views inside a viewgroup (root = Layout top-level) (linear, relative, framelayout etc..)
View view = inflater.inflate(R.layout.my_alert_dialog, (ViewGroup) findViewById(R.id.root));
Button button1 = (Button) view.findViewById(R.id.button1); // etc.. for button2,3,4.
alert.setView(view);
alert.show();