自定义对话框不显示

时间:2011-10-21 20:13:37

标签: android android-dialog

showDialog( DIALOG_CREATEPC ); // called elsewhere

private Dialog addPCDialog()
{
   final Dialog dialog = new Dialog( this );

   dialog.setContentView( R.layout.party_createpc );
   dialog.setTitle( "Add PC" );
   ...
   return dialog
}

@Override
protected Dialog onCreateDialog( int id )
{       
    Dialog dialog;
        switch( id )
        {
            case DIALOG_CREATEPC:
                dialog = addPCDialog();
                break;
            default:
                dialog = null;
        }
        return dialog;
    }

我在这里遗漏了什么吗?该对话框根本没有显示。

1 个答案:

答案 0 :(得分:0)

尝试覆盖onPrepareDialog而不是onCreateDialog

http://androidzteam.com/wpv/?p=44