我对需要滚动的应用程序布局和视图有一个奇怪的问题:
如果我使用默认的应用程序布局创建一个应用程序,则抽屉切换位于顶部,我添加了一个具有全尺寸的 VerticalLayout 作为视图,一切都按预期工作。但是,如果垂直内容超过了浏览器窗口的高度(即使我将此内容放入滚动条中),整个视图都会滚动并消失在切换开关的后面,直到达到切换的高度,然后滚动停止。它的接缝setHeight(100, Unit.Percentage)
不考虑肘节的高度。
有人有类似的问题吗?
编辑
将以下代码作为视图放入 AppLayout 并在您的移动设备(例如 iPhone)上打开它,您将看到垂直滚动条:
@Route(value = "application/test", layout = ApplicationLayout.class)
@PageTitle("Test")
@RolesAllowed({"ROLE_NEWSLETTER_ADMIN", "ROLE_ORGANIZATION_ADMIN"})
public class TestView extends VerticalLayout implements BeforeEnterObserver {
private MenuBar menu;
private Grid<Person> grid;
private Label footerLabel;
public TestView() {
this.setSizeFull();
menu = new MenuBar();
menu.addItem("New");
menu.addItem("Edit");
menu.addItem("Delete");
this.add(menu);
grid = new Grid<>(Person.class);
this.add(grid);
this.expand(grid);
footerLabel = new Label("Number of objetcs: #");
this.add(footerLabel);
}
@Override
public void beforeEnter(BeforeEnterEvent beforeEnterEvent) {
}
}
应用布局:
public class ApplicationLayout extends AppLayout implements AfterNavigationObserver {
private ApplicationService applicationService;
private H1 headerTitle;
public ApplicationLayout(ApplicationService applicationService) {
this.applicationService = applicationService;
createHeader();
createDrawer();
this.setPrimarySection(Section.DRAWER);
}
private void createHeader() {
// Define the header
HorizontalLayout header = new Header(new H1("Header"));
addToNavbar(header);
}
private void createDrawer() {
....
}
}