【问题标题】:Vaadin setExpandRatio doesn't workVaadin setExpandRatio 不起作用
【发布时间】:2014-05-06 17:39:49
【问题描述】:

此代码有效,中心面板正确展开:

HorizontalLayout header = new HorizontalLayout(new Label("HEADER"));
HorizontalLayout center = new HorizontalLayout(new Label("CENTER"));
HorizontalLayout footer = new HorizontalLayout(new Label("FOOTER"));        
VerticalLayout verticalLayout = new VerticalLayout(header, center, footer);
verticalLayout.setExpandRatio(center, 1.0f);
verticalLayout.setSizeFull();
setContent(verticalLayout);

但是这段代码不起作用,中心面板展开但左右面板不可见:

VerticalLayout left = new VerticalLayout(new Label("LEFT"));
VerticalLayout center = new VerticalLayout(new Label("CENTER"));
VerticalLayout right = new VerticalLayout(new Label("RIGHT"));
HorizontalLayout horizontalLayout = new HorizontalLayout(left, center, right);
horizontalLayout.setExpandRatio(center, 1.0f);
horizontalLayout.setSizeFull();
setContent(horizontalLayout);

知道为什么以及如何使它起作用吗?

感谢您的帮助!

【问题讨论】:

    标签: vaadin vaadin7


    【解决方案1】:

    VerticalLayout 默认具有 100% 的宽度。

    设置未定义的宽度:

    left.setSizeUndefinded();
    right.setSizeUndefined();
    

    left.setWidth(null);
    right.setWidth(null);
    

    【讨论】:

      猜你喜欢
      • 2013-06-14
      • 1970-01-01
      • 2015-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多