我有这个AlertDialog
并带有动态列表(当列表中的项目被选中时,列表的内容也会发生变化)。问题在于初始对话框的高度与父对象相匹配,但是当内容被更改并且尺寸更小时,对话框会封装内容。我如何避免这种情况?更改内容时的警报对话框大小
public ExplorerDialog(Context context, final SettingsDialog settingsDialog, int fileType) {
super(context);
setIcon(R.drawable.dialog_explorer_file_manager);
setTitle("Explorer Dialog");
setView(LayoutInflater.from(context).inflate(R.layout.dialog_explorer_layout, null));
setButton(BUTTON_POSITIVE, "Done", new OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
settingsDialog.show();
}
});
setButton(BUTTON_NEGATIVE, "Cancel", new OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
settingsDialog.show();
}
});
}
请出示相关的代码,比如你如何建立你的'AlertDialog ' – jnthnjns
这是代码: –
public ExplorerDialog(Context context,final SettingsDialog settingsDialog,int fileType){\t \t s UPER(上下文); \t \t \t \t setIcon(R.drawable.dialog_explorer_file_manager); \t \t setTitle(“Explorer Dialog”); \t \t setView(LayoutInflater.from(context).inflate(R.layout.dialog_explorer_layout,null)); \t \t SET按钮(BUTTON_POSITIVE, “完成”,新OnClickListener(){ \t \t \t公共无效的onClick(DialogInterface对话框,其中INT){ \t \t \t \t settingsDialog.show(); \t \t \t} \t \t }); \t \t SET按钮(BUTTON_NEGATIVE, “取消”,新OnClickListener(){ \t \t \t公共无效的onClick(DialogInterface对话框,其中INT){ \t \t \t \t settingsDialog.show(); \t \t}});} –