Vaadin 8中的可滚动布局

Vaadin 8中的可滚动布局,vaadin,vaadin8,Vaadin,Vaadin8,有时我能让它发挥作用,有时却没那么多,而且我似乎无法找出其中的因素 这是我正在使用的代码,它有时有效,有时压缩项目以适应垂直空间,而不添加滚动条 final VerticalLayout layout = new VerticalLayout(); setContent(layout); layout.setHeight("100%"); VerticalLayout thisshouldnotscroll=new VerticalLayout(); thissh

有时我能让它发挥作用,有时却没那么多,而且我似乎无法找出其中的因素

这是我正在使用的代码,它有时有效,有时压缩项目以适应垂直空间,而不添加滚动条

    final VerticalLayout layout = new VerticalLayout();
    setContent(layout);
    layout.setHeight("100%");
    VerticalLayout thisshouldnotscroll=new VerticalLayout(); thisshouldnotscroll.setHeight("100%");
    thisshouldnotscroll.addComponent(new Label("This should not scroll"));
    VerticalLayout thisshouldscroll=new VerticalLayout();
    thisshouldscroll.setHeight("100%");
    for (int i=0;i<200;i++){thisshouldscroll.addCompoenent(new Label("Item in list"));}
    layout.addComponents(thisshouldnotscroll,thisshouldscroll);
最终垂直布局=新建垂直布局();
设置内容(布局);
布局。设置高度(“100%”);
VerticalLayout This不应滚动=新建VerticalLayout();这不应该滚动。设置高度(“100%”);
This shouldnotScroll.addComponent(新标签(“This shouldnotScroll”));
VerticalLayout thisshouldscroll=新建VerticalLayout();
这应该是scroll.setHeight(“100%”);
对于(int i=0;i
是否有可滚动的VerticalLayout实现的片段

在Vaadin8中,有一个面板组件,基本上是一个可滚动的垂直布局。你试过了吗?

如果面板无法满足您的需要,并且您希望实现自己版本的可滚动布局,那么您必须嵌套2个布局。外部布局具有固定高度,即100%,而内部布局可以扩展到所需的任何大小。然后您将外部溢出设置为隐藏。我为Vaad制作了一个可滚动的垂直布局组件在Flow中,虽然您不能直接使用它,因为它与Vaadin 8不兼容,但您可以在我的项目中看到我是如何做到的,并在您的项目中复制它

是否有可滚动的VerticalLayout实现的片段

在Vaadin8中,有一个面板组件,基本上是一个可滚动的垂直布局。你试过了吗?

如果面板无法满足您的需要,并且您希望实现自己版本的可滚动布局,那么您必须嵌套2个布局。外部布局具有固定高度,即100%,而内部布局可以扩展到所需的任何大小。然后您将外部溢出设置为隐藏。我为Vaad制作了一个可滚动的垂直布局组件在Flow中,虽然您不能直接使用它,因为它与Vaadin 8不兼容,但您可以看到我在my中如何使用它,并在您的项目中复制它

将“thisshouldscroll”的overflow-y设置为scroll->overflow-y:scroll;将“thisshouldscroll”的overflow-y设置为scroll->overflow-y:scroll;