简体   繁体   中英

Align the content in SimplePanel in GWT

Anyone know how to put something in the center of SimplePanel or at least to arrange it somehow.

with HorizontalPanel adn VerticalPanel i could use setHorizontalAlignment() /setVerticalAlignment() but i am not able to find anything useful for SimplePanel.

I know that SimplePanel can have only one widget, but im required to use it.

Any advice?

Thanks

If you use UIBinder this should work

 <ui:style>
  .container {
     width:100%;
 }
 .content {
     width:200px;
     margin: 0 auto;
 }
</ui:style>
<g:SimplePanel addStyleNames="{style.container}">
    <g:HTMLPanel addStyleNames="{style.content}">
     <!-- CONTENT -->
    </g:HTMLPanel>
</g:SimplePanel>

Create Horizontal/Vertical panel. Add widget with required alignment. Add this panel to the SimplePanel.

You can also probably achieve it by tweaking the CSS instead of having an extra panel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM