Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Xamarin.Forms;
- namespace AbsoluteLayoutDemoVS
- {
- class MyContentPage : ContentPage
- {
- public MyContentPage()
- {
- AbsoluteLayout absoluteLayout = new AbsoluteLayout
- {
- VerticalOptions = LayoutOptions.FillAndExpand
- };
- Label firstLabel = new Label
- {
- Text = "FirstLabel"
- };
- /* Shorthand method:
- absoluteLayout.Children.Add(
- firstLabel,
- new Rectangle(
- 0, 0,
- AbsoluteLayout.AutoSize,
- AbsoluteLayout.AutoSize),
- AbsoluteLayoutFlags.PositionProportional);
- */
- absoluteLayout.Children.Add(firstLabel);
- AbsoluteLayout.SetLayoutFlags(firstLabel,
- AbsoluteLayoutFlags.PositionProportional);
- AbsoluteLayout.SetLayoutBounds(firstLabel,
- new Rectangle(0, 0, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
- this.Content = absoluteLayout;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment