【发布时间】:2012-11-22 15:27:26
【问题描述】:
I have this AlertDialog with and dynamic list in it(when a item from the list is selected the content of the list changes also).问题是初始对话框的高度与其父级匹配,但是当内容更改并且大小小得多时,对话框会包裹内容。我怎样才能避免这种情况?
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 -
public ExplorerDialog(Context context, final SettingsDialog settingsDialog, int fileType) { super(context); setIcon(R.drawable.dialog_explorer_file_manager); setTitle("浏览器对话框"); 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(); }});}
标签: android dialog resize height alert