I am using SmartGWT release 5.1-p20160505.
I am trying to get a layout contained within another layout to be centered vertically and horizontally. I can get horizontal centering but so far I have been unable to achieve vertical centering.
Here is my test code:
Notes on the test code:
I am trying to get a layout contained within another layout to be centered vertically and horizontally. I can get horizontal centering but so far I have been unable to achieve vertical centering.
Here is my test code:
Code:
[B]public[/B] [B]class[/B] VerticalCenteringEntry [B]implements[/B] EntryPoint {
@Override
[B]public[/B] [B]void[/B] onModuleLoad() {
containerLayout().show();
}
[B]private[/B] VLayout containerLayout() {
[B]return[/B] [B]new[/B] VLayout() {
{
setLayoutAlign(VerticalAlignment.[B][I]CENTER[/I][/B]);
setWidth(500);
setHeight(500);
setBorder("1px solid black");
addMember(containedLayout());
}
};
}
[B]private[/B] VLayout containedLayout() {
[B]return[/B] [B]new[/B] VLayout() {
{
setLayoutAlign(VerticalAlignment.[B][I]CENTER[/I][/B]);
setWidth(300);
setHeight(300);
setBorder("1px solid red");
}
};
}
}
- I tried setLayoutAlign(VerticalAlignment.CENTER) in the container layout alone, in the contained layout alone, and in both layouts. In all cases vertical centering is not achieved.
- setLayoutAlign(VerticalAlignment.CENTER) causes horizontal centering.
Comment