Vaadin 面板显示不正确

Vaadin panels not displaying correctly

您好,我正在尝试创建 2 个面板,一个作为侧边栏,另一个作为内容面板,但它们显示不正确。两个面板之间有一个巨大的白色 space。有谁知道如何解决这个问题?

HorizontalLayout mainlayout = new HorizontalLayout();
mainlayout.setSizeFull();

Panel sidepanel = new Panel();
sidepanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
sidepanel.setHeight("100%");
sidepanel.setWidth("20%");      

Panel content = new Panel();
content.addStyleName(ValoTheme.PANEL_BORDERLESS);
content.setHeight("100%");
content.setWidth("80%");

mainlayout.addComponent(sidepanel);
mainlayout.addComponent(content);

将两个面板设置为 100% 大小。 然后设置父布局的展开比例为20和80。

https://vaadin.com/api/com/vaadin/ui/AbstractOrderedLayout.html#setExpandRatio%28com.vaadin.ui.Component,%20float%29

HorizontalLayout mainlayout = new HorizontalLayout();
mainlayout.setSizeFull();

Panel sidepanel = new Panel();
sidepanel.addStyleName(ValoTheme.PANEL_BORDERLESS);

Panel content = new Panel();
content.addStyleName(ValoTheme.PANEL_BORDERLESS);

mainlayout.addComponent(sidepanel);
mainlayout.addComponent(content);

mainlayout.setExpandRatio(sidepanel, 2);
mainlayout.setExpandRatio(content, 8);