简单实用,直接上代码看吧: package irdc.ex03_12; import android.app.Activity; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.app.AlertDialog; import android.content.DialogInterface; public class EX03_12 extends Activity { /** Called when the activity is first created. */ private Button b1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); b1 = (Button) findViewById(R.id.clickme); b1.setOnClickListener( new Button.OnClickListener() { public void onClick(View v) { new AlertDialog.Builder(EX03_12.this) .setTitle(R.string.app_about) .setMessage(R.string.app_about_msg) .setPositiveButton(R.string.str_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialoginterface,int i) { /*在这里写对话按钮单击后要运行的事件*/ } } ) .show(); } } ); } } 如果单击后要离开对话框页面,则可以调用 finish() 即可。