2012-04-03 90 views
1

我试图在PreferenceActivity中实现一个自定义对话框,该对话框中仍然有对话框中的Android通用正/中性/负性按钮,即自定义AlertDialog。本文的底部示例中描述了该方法:Dialogs on Android developer pages在PreferenceActivity中获取root ViewGroup

不过,我不能找到一个办法让根的PreferenceActivity这样做的:

View layout = inflater.inflate(R.layout.custom_dialog, 
          (ViewGroup) findViewById(R.id.??????)); 

有谁知道如何做到这一点?

回答

2

试试这个得到任何观点rootview

View layout = inflater.inflate(R.layout.custom_dialog,null); 
View view = layout.getRootView();