Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

AbsoluteLayout mayhem

$
0
0

We're having a hard time understanding the LayoutBounds parameters which we assumed is what we have to tinker with. I attached an image to show the current behaviour and the XAML file is below.

How can we center the StackLayout vertically in this scenario?

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:Klaim;assembly=Klaim"
             x:Class="Klaim.MainPage"
             BackgroundColor="#ffffff">

    <ContentPage.Padding>
        <OnPlatform x:TypeArguments="Thickness"
                    iOS="0, 20, 0, 0"
                    Android="0, 0, 0, 0"
                    WinPhone="0, 0, 0, 0" />
    </ContentPage.Padding>

    <ContentPage.Content>
        <AbsoluteLayout HorizontalOptions="FillAndExpand"
                        VerticalOptions="FillAndExpand">
            <StackLayout AbsoluteLayout.LayoutFlags="All"
                         AbsoluteLayout.LayoutBounds="0,0,1,1"
                         Padding="20, 20, 20, 20">
                <Image Source="logo_magiklaim.png" />
                <Entry x:Name="edtEmail"
                       Keyboard="Email"
                       Placeholder="Courriel" />
                <Entry x:Name="edtPassword"
                       Keyboard="Text"
                       IsPassword="true"
                       Placeholder="Mot de passe" />
                <local:ButtonView x:Name="btnLogin"
                                  Clicked="btnLoginClicked"
                                  Text="Se connecter" />
            </StackLayout>
            <ContentView x:Name="actIndBackground"
                         BackgroundColor="#222222" Opacity="0.5"
                         AbsoluteLayout.LayoutFlags="All"
                         AbsoluteLayout.LayoutBounds="0,0,1,1"
                         IsVisible="false">
            </ContentView>
            <ActivityIndicator x:Name="actInd"
                               AbsoluteLayout.LayoutFlags="PositionProportional"
                               AbsoluteLayout.LayoutBounds="0.5,0.5,-1,-1"
                               IsRunning="false" />
        </AbsoluteLayout>
    </ContentPage.Content>
</ContentPage>

Viewing all articles
Browse latest Browse all 58056

Trending Articles