且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android系统显示自定义对话框

更新时间:2023-01-23 21:37:36

试试这个code

 protected Dialog onCreateDialog(int id) {
  Dialog dialog;
  switch(id) {
   case 0:
    dialog = new Dialog(this);

    dialog.setContentView(R.layout.paused);
    dialog.setTitle("Game Paused");
    dialog.show();
    break;
default:
    dialog = null;
}
return null;

}

我刚刚更换对话框=新的对话框(getApplicationContext()),以对话框=新的对话框(本);

I just replaced dialog = new Dialog(getApplicationContext()) to dialog = new Dialog(this);