I was trying RelativeLayout in Xamarin Forms for the first time.
I was hoping to get the login fields (entries along with login button), in the middle of the screen, also width to be half of its parent.
I am confused, couldn't figure out the problems :
1. StackLayout is not in the center of RelativeLayout
2. StackLayout width to be half of RelativeLayout
<RelativeLayout HorizontalOptions="FillAndExpand"
VerticalOptions="Center"
BackgroundColor="Yellow">
<StackLayout Orientation="Vertical"
HorizontalOptions="Center"
BackgroundColor="Red"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Width,
Factor=0.5 }" >
<Entry Placeholder="Client Code" />
<Entry Placeholder="Tab Code" />
<Entry Placeholder="User name" />
<Entry Placeholder="Password" />
<Button Text="LOGIN" TextColor="White" BackgroundColor="Red" />
</StackLayout>
</RelativeLayout>