I am very new to NativeScript
. I am following its own document. I am trying for UI Alignment. I unable to achieve this. I am using Xcode IDE
and running in iOS Simulator
.
Groceries Logo should be in Top
Textfields should be in middle
Sign up button should be in Bottom
Attempt 1
<Page loaded="loaded">
<GridLayout height=auto horizontalAlignment="center" verticalAlignment="center" columns="*" rows="auto,auto,*" backgroundColor="brown">
<Image src="res://logo" stretch="aspectFit" horizontalAlignment="center" verticalAlignment="top" col="0" row="0"></Image>
<GridLayout columns="*" rows="auto,auto,auto" verticalAlignment="center" backgroundColor="lightgray" col="0" row="1">
<TextField class="userTxtFld" id="email" text="{{ email }}" hint="Email Address" keyboardType="email" autocorrect="false" autocapitalizationType="none" col="0" row="0"/>
<TextField secure="true" text="{{ password }}" hint="Password" col="0" row="1"/>
<Button text="Sign in" tap="signIn" col="0" row="2"/>
</GridLayout>
<Button text="Sign up for Groceries" class="link" tap="register" verticalAlignment="bottom" col="0" row="2"/>
</GridLayout>
</Page>
Attempt 2
<Page loaded="loaded">
<GridLayout height="auto" horizontalAlignment="center" verticalAlignment="center" columns="*" rows="auto,auto,*" backgroundColor="brown">
<Image src="res://logo" stretch="aspectFit" horizontalAlignment="center" verticalAlignment="top" col="0" row="0"></Image>
<GridLayout columns="*" rows="auto,auto,auto" verticalAlignment="center" backgroundColor="lightgray" col="0" row="1">
<TextField class="userTxtFld" id="email" text="{{ email }}" hint="Email Address" keyboardType="email" autocorrect="false" autocapitalizationType="none" col="0" row="0"/>
<TextField secure="true" text="{{ password }}" hint="Password" col="0" row="1"/>
<Button text="Sign in" tap="signIn" col="0" row="2"/>
</GridLayout>
<Button text="Sign up for Groceries" class="link" tap="register" verticalAlignment="bottom" col="0" row="2"/>
</GridLayout>
</Page>
Issue
In attempt 1, height=auto and in attempt 2, height="auto"
I need output as Attempt 1.
I dont know, why backgroundcolor
is not displaying in height=auto
I dont know, why UI Alignment
is not fixing in height="auto"
If height="auto" is right way, how to do get output as Attempt 1?
Kindly help me this.
Output