Skip to content

Instantly share code, notes, and snippets.

@Axemasta
Last active February 2, 2018 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Axemasta/c5b434ed5bbb65a001f26ea14f4abaef to your computer and use it in GitHub Desktop.
Save Axemasta/c5b434ed5bbb65a001f26ea14f4abaef to your computer and use it in GitHub Desktop.
XAML Code that demonstrates how you can add a button over a scroll view for a Xamarin app
<?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:ScrollViewFormatting"
x:Class="ScrollViewFormatting.ScrollViewFormattingPage">
<ContentPage.Padding>
<OnPlatform x:TypeArguments="Thickness">
<OnPlatform.iOS>0,20,0,0</OnPlatform.iOS>
</OnPlatform>
</ContentPage.Padding>
<ContentPage.Content>
<AbsoluteLayout>
<RelativeLayout>
<ScrollView BackgroundColor="Yellow"
RelativeLayout.XConstraint="0"
RelativeLayout.YConstraint="0"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent,Property=Width,Factor=1,Constant=0}"
RelativeLayout.HeightConstraint="{ConstraintExpression
Type=RelativeToParent,Property=Height,Factor=1,Constant=0}"
>
<StackLayout Padding="20,20,20,20"
Spacing="20"
>
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
<Label Text="Dummy Text Here..."
TextColor="Black"
BackgroundColor="Lime" />
</StackLayout>
</ScrollView>
</RelativeLayout>
<Button Text="Press Me!"
TextColor="White"
BackgroundColor="Black"
AbsoluteLayout.LayoutBounds="0.5, 0.95, 200, 50"
AbsoluteLayout.LayoutFlags="PositionProportional"
/>
</AbsoluteLayout>
</ContentPage.Content>
</ContentPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment