--- layout: home title: Yoga id: home ---

C

```c YGNodeRef root = YGNodeNew(); YGNodeStyleSetWidth(root, 500); YGNodeStyleSetHeight(root, 120); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetPadding(root, YGEdgeAll, 20); YGNodeRef image = YGNodeNew(); YGNodeStyleSetWidth(image, 80); YGNodeStyleSetMargin(image, YGEdgeEnd, 20); YGNodeRef text = YGNodeNew(); YGNodeStyleSetHeight(text, 25); YGNodeStyleSetAlignSelf(text, YGAlignCenter); YGNodeStyleSetFlexGrow(text, 1); YGNodeInsertChild(root, image, 0); YGNodeInsertChild(root, text, 1); ```

OBJ-C

```objc UIView *root = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 300)]; [root configureLayoutWithBlock:^void(YGLayout *layout) { layout.isEnabled = YES; layout.alignItems = YGAlignCenter; layout.justifyContent = YGJustifyContentCenter; layout.padding = 20.0f; }]; UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 150, 150)]; [image configureLayoutWithBlock:^void(YGLayout *layout) { layout.isEnabled = YES; layout.marginBottom = 20.0f; }]; [root addSubview:image]; UILabel *text = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 25, 100)]; [root addSubview:text]; ```

JAVA

```java YogaNode root = new YogaNode(); root.setWidth(500); root.setHeight(300); root.setAlignItems(CENTER); root.setJustifyContent(CENTER); root.setPadding(ALL, 20); YogaNode text = new YogaNode(); text.setWidth(200); text.setHeight(25); YogaNode image = new YogaNode(); image.setWidth(50); image.setHeight(50); image.setPositionType(ABSOLUTE); image.setPosition(END, 20); image.setPosition(TOP, 20); root.addChildAt(text, 0); root.addChildAt(image, 1); ```

C#

```csharp YogaNode root = new YogaNode { Width = 500, Height = 300 }; YogaNode image = new YogaNode { FlexGrow = 1 }; YogaNode text = new YogaNode { Width = 300, Height = 25, Margin = 20 }; root.Insert(image, 0); root.Insert(text, 1); ```

Android

```xml ```