The relative layout in 2dx is very similar to that in Android. It should be very easy to use if you have done Android before.
Size widgetSize = Director: getInstance ()-> getWinSize (); Text * alert = Text: create ("Layout", "fonts/Marker Felt. ttf ", 30); alert-> setColor (Color3B (159,168,176); alert-> setPosition (Point (widgetSize. width/2.0f, widgetSize. height/2.0f-alert-> getSize (). height * 3.075f); addChild (alert); Layout * layout = Layout: create (); layout-> setSize (Size (widgetSize. width, widgetSize. height); // horizontal arrangement, similar to the linear layout-> setLayoutType (LAYOUT_RELATIVE) in Android;/* use the image as the background */layout-> setBackGroundImageScale9Enabled (true ); layout-> setBackGroundImage ("green_edit.png"); layout-> setPosition (Point (0, 0); addChild (layout); Button * button_TopLeft = Button: create ("animationbuttonnormal.png ", "Parameters"); layout-> addChild (button_TopLeft); Parameters * rp_TopLeft = values: create (); rp_TopLeft-> setAlign (parameters); button_TopLeft-> setLayoutParameter (rp_TopLeft ); // top center horizontal Button * button_TopCenter = Button: create ("success", "success"); layout-> addChild (button_TopCenter); RelativeLayoutParameter * rp_TopCenter = RelativeLayoutParameter :: create (); rp_TopCenter-> setAlign (parameters); button_TopCenter-> setLayoutParameter (rp_TopCenter); Button * button_TopRight = Button: create ("Parameters", "animationbuttonpressed.png "); layout-> addChild (button_TopRight); Parameters * rp_TopRight = values: create (); rp_TopRight-> setAlign (values); button_TopRight-> setLayoutParameter (rp_TopRight ); // left center Button * button_LeftCenter = Button: create ("centers", "centers"); layout-> addChild (button_LeftCenter); RelativeLayoutParameter * rp_LeftCenter = RelativeLayoutParameter :: create (); rp_LeftCenter-> setAlign (align); button_LeftCenter-> setLayoutParameter (rp_LeftCenter); // center Button * buttonCenter = Button: create ("animationbuttonnormal.png ", "Parameters"); layout-> addChild (buttonCenter); RelativeLayoutParameter * rpCenter = RelativeLayoutParameter: create (); rpCenter-> setAlign (parameters); buttonCenter-> setLayoutParameter (rpCenter ); button * button_RightCenter = Button: create ("centers", "centers"); layout-> addChild (button_RightCenter); RelativeLayoutParameter * rp_RightCenter = RelativeLayoutParameter: create (); rp_RightCenter-> setAlign (region); button_RightCenter-> setLayoutParameter (rp_RightCenter); // left bottom Button * button_LeftBottom = Button: create ("region", "region "); layout-> addChild (parameters); RelativeLayoutParameter * rp_LeftBottom = RelativeLayoutParameter: create (); rp_LeftBottom-> setAlign (parameters); parameters-> setLayoutParameter (rp_LeftBottom ); // bottom center Button * button_botw.enter = Button: create ("success", "success"); layout-> addChild (button_bot1_enter); RelativeLayoutParameter * rp_bot1_enter = RelativeLayoutParameter :: create (); rp_bottingenter-> setAlign (parameters); button_bottingenter-> setLayoutParameter (rp_bottingenter); Button * button_RightBottom = Button: create ("Parameters", "Parameters "); layout-> addChild (response); RelativeLayoutParameter * rp_RightBottom = RelativeLayoutParameter: create (); rp_RightBottom-> setAlign (response); response-> setLayoutParameter (rp_RightBottom );