2011-03-29 66 views
1

我真的想用单个按钮制作AlertDialog,有人可以用这个指导我。谢谢!AlertDialog单按钮?

+3

任何线索?语言,平台,网络/桌面 – 2011-03-29 19:38:19

+0

我想在android – 2011-03-29 19:39:09

+0

中创建一个Alert Dialog您正在使用哪种语言和/或平台? 'AlertDialog'可能来自Android,那是你在做什么? – jmccarthy 2011-03-29 19:40:03

回答

2

是,您可以:

new AlertDialog.Builder(this) 
.setIcon(R.drawable.icon) 
.setTitle("Error") 
.setMessage("Please fill out the entire form") 
.setPositiveButton("Close", new DialogInterface.OnClickListener() { 

    @Override 
    public void onClick(DialogInterface dialog, int which) { 

    } 
}) 
.create() 
.show() 
; 
0

使用AlertDialog.Builder

AlertDialog.Builder builder = new AlertDialog.Builder(this); 
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { 
    public onClick(DialogInterface dialog, int which) { 
     // do something interesting. 
    } 
}); 
// other code to customize the dialog 
Dialog d = builder.create();