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

Needing some assistance on getting my padding correct..........

$
0
0

I have a simple XAML Page, and I am trying to figure out how to get the padding setup correctly. On Android it looks fine, but on iOS, the labels are all on the very edge of the screen. I know I'm doing something wrong, but I've been searching for a solution and I'm not having any luck.

In my XAML page, I have this:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:constants="clr-namespace:XamarinFormsSample;assembly=XamarinFormsXamlSample"
x:Class="OmniMobile.DefendantDetailsPage"
Title="Person Details">
  <ContentPage.Padding>
    <OnPlatform x:TypeArguments="Thickness"
                iOS="20, 40, 20, 20"
                Android="20, 20, 20, 20"
                WinPhone="20, 20, 20, 20" />
  </ContentPage.Padding>
</ContentPage>

In my code behind, I am creating a creating labels and adding them like this:

`var foo = new Label
{
Text = "Foo: " + myFoo
};

Content = new StackLayout
{
Spacing = 10,
Padding = new Thickness(20, 40, 20, 20),
Children = ( foo }
};`

Thanks for the help everyone. This place has been great in bearing with me on my questions.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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