Reputation: 23
Do all elements gets positioned one above other of its parent? for example,consider the following code sample and the output I got.
<Alloy>
<Window class="container" backgroundColor="white">
<Label id="label" >Hello, World</Label>
<TextField></TextField>
<Button>click me</Button>
</Window>
</Alloy>
Upvotes: 2
Views: 62
Reputation: 276
Elements in Titanium are positioned relative to their parent container, such as the window or a view. Depending on the positioning properties you use, the reference point will be either the parent's top/left or bottom/right corner.
When you omit these properties in a view object you are placing the view on the coordinates grid in the default position, with the default layout property, which is the centre of the window. The default position is dependant on the layout mode of the parent view / window. These three layout properties are: Absolute, Vertical and horizontal.
Absolute layout (Default)
The default mode as you add views to a parent container, when no properties are added views will go to the centre point, they will overlay any views you previously added. You change change this around by taking advantage of the zIndex property.
The best link to read is the wiki docs on Ti's layout, positioning and view hierarchy. This covers all three layout properties and goes into much more detail on titaniums positioning properties.
https://wiki.appcelerator.org/display/guides2/Layouts,+Positioning,+and+the+View+Hierarchy
Upvotes: 1