Last active
October 9, 2015 16:54
-
-
Save mattregul/fe557b784946a80a4e3e to your computer and use it in GitHub Desktop.
Multiple Xamarin.Forms ActivityIndicator Colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Xamarin.Forms; | |
namespace FormsGallery | |
{ | |
class ActivityIndicatorDemoPage : ContentPage | |
{ | |
public ActivityIndicatorDemoPage() | |
{ | |
Label header = new Label | |
{ | |
Text = "ActivityIndicator", | |
FontSize = 40, | |
FontAttributes = FontAttributes.Bold, | |
HorizontalOptions = LayoutOptions.Center | |
}; | |
ActivityIndicator activityIndicator01 = new ActivityIndicator | |
{ | |
Color = Device.OnPlatform(Color.Black, Color.Default, Color.Default), | |
IsRunning = true, | |
VerticalOptions = LayoutOptions.CenterAndExpand | |
}; | |
ActivityIndicator activityIndicator02 = new ActivityIndicator | |
{ | |
Color = Color.Red, | |
IsRunning = true, | |
VerticalOptions = LayoutOptions.CenterAndExpand | |
}; | |
ActivityIndicator activityIndicator03 = new ActivityIndicator | |
{ | |
Color = Color.Blue, | |
IsRunning = true, | |
VerticalOptions = LayoutOptions.CenterAndExpand | |
}; | |
ActivityIndicator activityIndicator04 = new ActivityIndicator | |
{ | |
Color = Color.Green, | |
IsRunning = true, | |
VerticalOptions = LayoutOptions.CenterAndExpand | |
}; | |
ActivityIndicator activityIndicator05 = new ActivityIndicator | |
{ | |
Color = Color.Purple, | |
IsRunning = true, | |
VerticalOptions = LayoutOptions.CenterAndExpand | |
}; | |
// Build the page. | |
this.Content = new StackLayout | |
{ | |
Children = | |
{ | |
header, | |
activityIndicator01, | |
activityIndicator02, | |
activityIndicator03, | |
activityIndicator04, | |
activityIndicator05 | |
} | |
}; | |
} | |
} | |
} |
This is a modified version of the ActivityIndicatorDemoPage inside the Xamarin-Forms/FormsGallery repository
You can find it here:
- https://github.com/xamarin/xamarin-forms-samples/tree/master/FormsGallery
- http://developer.xamarin.com/samples/xamarin-forms/FormsGallery/
Other Forms Samples:
- https://github.com/xamarin/xamarin-forms-samples
- http://developer.xamarin.com/samples/xamarin-forms/all/
- http://developer.xamarin.com/guides/cross-platform/xamarin-forms/
- http://developer.xamarin.com/guides/cross-platform/xamarin-forms/introduction-to-xamarin-forms/
- http://developer.xamarin.com/samples/tag/Xamarin.Forms/
- http://blog.xamarin.com/behaviors-in-xamarin.forms/
Forms XAML Samples:
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Different Colors, based on Operating System / Platform
https://gist.github.com/mattregul/fe557b784946a80a4e3e#file-activityindicatordemopage-cs-L20
Creating a Red ActivityIndicator
https://gist.github.com/mattregul/fe557b784946a80a4e3e#file-activityindicatordemopage-cs-L27