//About Button in the principal menu
final Button button3 = (Button) findViewById(R.id.button3);
button3.setOnClickListener(
new OnClickListener() {
public void onClick(View v) {
//set up dialog
Dialog dialog = new Dialog(MainMenu.this);
dialog.setContentView(R.layout.maindialog);
dialog.setTitle("About");
dialog.setCancelable(true);
//now that the dialog is set up, it's time to show it
dialog.show();
Button closeButton = (Button) dialog.findViewById(R.id.Button01);
// closeButton.setOnClickListener(new Button.OnClickListener() {
// public void onClick(View view) {
// dialog.dismiss();
// }
// });
if(v==closeButton)
dialog.dismiss();
}
});
我有這段代碼但解僱不起作用。不能關閉自定義對話框
我有一個「關於」按鈕,當我點擊它顯示對話框窗口。 然後對話窗口有一個「確定」按鈕,該確定按鈕應關閉該對話框但辭退不工作。 你能幫我知道爲什麼嗎?
大!感謝您的幫助。非常感謝unholysampler = D – Ricardo
感謝您幫助我Glendon Trullinger! :) – Ricardo