弹出窗口是一个装饰弹出窗口,其中的文本是标签,关闭是一个按钮。 我已将标签和按钮添加到水平面板,然后将其添加到弹出面板。我尝试过invalidEntryVpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); invalidEntryVpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
但仍然无法在中心对齐请帮助。提前谢谢
答案 0 :(得分:1)
试试这个
您必须在设置align center
VerticalPanel vpnPanel = new VerticalPanel();
vpnPanel.add(scrollPanel); //all controls added to scrill panel with help of set widget
vpnPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
HorizontalPanel btnLayoutPanel = new HorizontalPanel();
btnLayoutPanel.setSpacing(10);
btnLayoutPanel.add(closeButton);
vpnPanel.add(btnLayoutPanel);
decPopuppanel.setWidget(vpnPanel);