2012-02-06 81 views
0

有没有办法使用AlertBuilder样式自己的Dialog扩展类?现在我有:从AlertBuilder扩展的对话框?

@Override 
protected Dialog onCreateDialog(int id) { 
    LayoutInflater inflater = LayoutInflater.from(this); 

    switch (id) { 
     case MY_DIALOG: 
      View view = inflater.inflate(R.layout.my_dlg_layout, null); 

      AlertDialog dlg = new AlertDialog.Builder(this) 
       .setView(view) 
       .create(); 
      return dlg; 
    } 

    return null; 
} 

但它变得太疯狂了,我想将对话框定义移到它自己的类中。 (上面看起来不错,为了清晰起见,我跳过了很多 - 基本上我使用AlertBuilder使用了一些复杂的自定义视图)。

我非常想使用Dialog Fragment,但还没有做好准备,我需要将它作为一个临时的东西。

感谢

回答

0

有没有用我自己的对话框扩展类的 AlertBuilder风格

class MyClass extends AlertDialog.Builder{ 
      . . . 
} 
方式