Skip to content

Instantly share code, notes, and snippets.

@jfversluis
Created January 16, 2017 18:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jfversluis/5f356044688d2faea060fc9748fc4b33 to your computer and use it in GitHub Desktop.
Android platform specific SwitchEffect
using Android.Graphics;
using Android.Support.V7.Widget;
using EffectsSample.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ResolutionGroupName ("MyCompany")]
[assembly: ExportEffect (typeof (SwitchEffect), "SwitchEffect")]
namespace EffectsSample.Droid
{
public class SwitchEffect : PlatformEffect
{
protected override void OnAttached ()
{
if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.JellyBean) {
((SwitchCompat)Control).ThumbDrawable.SetColorFilter (Xamarin.Forms.Color.Red.ToAndroid (), PorterDuff.Mode.Multiply);
}
}
protected override void OnDetached ()
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment