调整浏览器大小时,我无法调整contentpanel的大小。以下代码呈现内容面板以填充屏幕(所需),但在更改浏览器窗口大小时不会调整大小。
代码:
public void onModuleLoad() {
RootPanel rootPanel = RootPanel.get();
Viewport viewPort = new Viewport();
final Layout layout = new FitLayout();
ContentPanel resultPanel = new ContentPanel();
resultPanel.setHeading("Result");
resultPanel.setFrame(true);
resultPanel.setLayout(layout);
resultPanel.setScrollMode(Scroll.ALWAYS);
resultPanel.addButton(new Button("OK"));
resultPanel.setWidth("100%");
LayoutContainer page = new LayoutContainer(new RowLayout(Orientation.VERTICAL));
page.add(resultPanel, new com.extjs.gxt.ui.client.widget.layout.RowData(1, -1));
viewPort.add(page);
rootPanel.add(viewPort);
page.layout();
}
答案 0 :(得分:1)
视口也需要fitlayout:
viewPort.setLayout(new FitLayout());