问题描述
如何使图标和文本在 Vaadin HorizontalLayout 内垂直对齐居中?
此代码无效:
HorizontalLayout horizontalLayout = new HorizontalLayout(VaadinIcon.EXCLAMATION_CIRCLE_O.create(),new H5("Achtung - Bitte aufmerksam lesen!") );
horizontalLayout.setAlignItems(FlexComponent.Alignment.CENTER);
解决方法
你检查文档了吗? https://vaadin.com/components/vaadin-ordered-layout/java-examples 有各种各样的例子
horizontalLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);