Advertisement
smeacham

MyContentPage.cs

May 17th, 2016
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. using Xamarin.Forms;
  8.  
  9. namespace LoadingScreen
  10. {
  11.     class MyContentPage : ContentPage
  12.     {
  13.         public MyContentPage ()
  14.         {
  15.             StackLayout loadingView = new StackLayout
  16.             {
  17.                 Orientation = StackOrientation.Horizontal,
  18.                 BackgroundColor = Color.Gray,
  19.                 Children =
  20.                 {
  21.                     new ActivityIndicator
  22.                     {
  23.                         Color = Color.White,
  24.                         IsRunning = true,
  25.                         VerticalOptions = LayoutOptions.Center,
  26.                         WidthRequest = 20,
  27.                         HeightRequest = 20
  28.                     },
  29.                     new Label
  30.                     {
  31.                         TextColor = Color.White,
  32.                         Text = "Loading...",
  33.                         VerticalOptions = LayoutOptions.Center
  34.                     }
  35.                 }
  36.             };
  37.  
  38.             AbsoluteLayout layout = new AbsoluteLayout
  39.             {
  40.                 HorizontalOptions = LayoutOptions.FillAndExpand,
  41.                 VerticalOptions = LayoutOptions.FillAndExpand,
  42.                 Children =
  43.                 {
  44.                     {   // this is the "existing content" placeholder
  45.                         new BoxView { Color = Color.Accent },
  46.                         new Rectangle(0,0,1,1),
  47.                         AbsoluteLayoutFlags.All
  48.                     },
  49.                     {
  50.                         loadingView,
  51.                         new Rectangle(
  52.                             0.5, 0.5,
  53.                             AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize),
  54.                         AbsoluteLayoutFlags.PositionProportional
  55.                     }
  56.                 }
  57.             };
  58.  
  59.             this.Content = layout;
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement