// percentages.
Document doc = Document.get();
Element parent = doc.createDivElement();
doc.getBody().appendChild(parent);
Layout layout = new Layout(parent);
layout.onAttach();
Element topChild = doc.createDivElement(), bottomChild = doc
.createDivElement();
Layer topLayer = layout.attachChild(topChild);
Layer bottomLayer = layout.attachChild(bottomChild);
// Stack the two children vertically, meeting at 50%.
topLayer.setLeftRight(0, PX, 0, PX);
bottomLayer.setLeftRight(0, PX, 0, PX);
topLayer.setTopHeight(0, PCT, 50, PCT);
bottomLayer.setBottomHeight(0, PCT, 50, PCT);
layout.layout();
// Update the two children to stack horizontally, meeting at 10em.
// Also have them animate for 500ms.
topLayer.setTopBottom(0, PX, 0, PX);
bottomLayer.setTopBottom(0, PX, 0, PX);
topLayer.setLeftWidth(0, EM, 10, EM);
bottomLayer.setLeftRight(10, EM, 0, EM);
layout.layout(500);
}