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

How to fit all controls on screen?

$
0
0

Hi everyone,

I have the following layout:

<ContentPage 
    xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:Project.UI;assembly=Project.UI"
    x:Class="Project.UI.LearnPage">
    <ContentPage.Content>
        <StackLayout
            x:Name = "rootLayout"
            Orientation = "Vertical"
            Padding = "0, 10, 0, 10"
            BackgroundColor = "Red" >
            <local:LabelFont 
                x:Name = "remainingCardsLabel"
                Text = "TestText"
                FontSize = "20"
                HorizontalOptions = "Center" />
            <RelativeLayout
                x:Name = "cardLayout"
                BackgroundColor = "Aqua" >
                <Image 
                    x:Name = "cardImage"
                    Source = "Testkarte.png"
                    BackgroundColor = "Green" />
                <local:LabelFont 
                    Text = "1"
                    FontSize = "20" />
                <local:LabelFont 
                    Text = "2" />
                <local:LabelFont 
                    Text = "3" />
                <local:LabelFont 
                    Text = "4" />
                <local:LabelFont 
                     Text = "5"/>
                <local:LabelFont 
                Text = "6" />
        </RelativeLayout>
        <StackLayout BackgroundColor = "Fuschia">
            <Button Text = "Button" />
        </StackLayout>
    </StackLayout>
</ContentPage.Content>

As soon as I put my Image into the xaml, the StackLayout on the bottom gets pushed out of the screen. Even when I scale my image down to 0.75 and its clearly not taking all the space around it, the StackLayout is still not visible.
Removing the image from the xaml shows the StackLayout on the bottom of the screen (even that I don't know why its happen because I can't see where I set my RelativeLayout to take all the space in the middle).

Maybe someone can help me with this because right now RelativeLayouts are a pain for me...


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>