Displaying Text

Add text to the app by enhancing the layout_phone.xml:

<?xml version="1.0" encoding="UTF-8"?>
<MAF xmlns="http://schemas.sap.com/maf/2012/cfg">
	<!-- Define a "tile" - it translates to UIViewController -->
	<Tile tileId="First Extensible Screen">
		<!-- This is our root view -->
		<P pid="isRoot" value="true" />
		<!-- Define the layout container. All UI elements included in a layout container will be auto-arranged -->
		<LinearContainer layout="vertical">
			<!-- Define our label -->
			<UIElement type="label">
				<!-- Assign the text to be displayed -->
				<P pid="text" value="Hello World! This is Extensibility!"></P>
				<!-- Default styling is automatically applied (see MAFUIComponents.bundle -> SAPDefaultStyle.xml) -->
			</UIElement>
		</LinearContainer>
	</Tile>
</MAF>
This code first adds a linear container, which arranges the content to be shown based on several criteria. It does not specify additional layout parameters for brevity, therefore the defaults apply. It then adds a label type UI element, a TextView, and assigns a static text to it. You can localize texts, but doing so is outside the scope of this sample.
Displaying_Text
By inserting the code above, you have added the label with the text by editing the layout XML, without performing any code changes. You can change the position and dimensions of the label - centering it horizontally on the screen, and adjusting it vertically 20 points below the toolbar - by inserting these lines in the UIElement section:
<P pid="halign" value="center"></P> 
<P pid="margin_top" value="20pt"></P>
To move the text to the center of the screen, comment out the line with "margin_top", and add this line:
<P pid="valign" value="center"></P>
There are several settings allowing you to fine-tune the position and dimensions of the tiles and UI elements. See the metadata XML for all possible values.