Created
January 16, 2017 18:02
Star
You must be signed in to star a gist
Android platform specific SwitchEffect
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 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