當前位置:編程學習大全網 - 腳本源碼 - android中如何在對話框中按鈕實現返回鍵的功能。就是關閉當前對話框返回上壹個界面。

android中如何在對話框中按鈕實現返回鍵的功能。就是關閉當前對話框返回上壹個界面。

直接給妳貼代碼了。這樣直接壹些兄弟。

new AlertDialog.Builder(activity)

.setMessage(R.string.title_cancel_alertdialog)

.setPositiveButton(“確認”, new DialogInterface.OnClickListener() {//確認按鈕

public void onClick(DialogInterface arg0, int arg1) {

//按鈕點擊後觸發的動作,點擊後對話框是自動消失的

}

})

.setNegativeButton("取消", new DialogInterface.OnClickListener() {//取消按鈕

public void onClick(DialogInterface arg0, int arg1) {

//按鈕點擊後觸發的動作,點擊後對話框是自動消失的

}

}).show();

  • 上一篇:簡單的插畫圖關於生日-怎麽做生日賀卡簡單又漂亮立體
  • 下一篇:百度網盤賬號怎麽改
  • copyright 2024編程學習大全網