title: Gradient background for button - Custom Renderer
body: <p>I have problem with make a Custom Renderer for Button with gradient background in Android project. On iOS I used this code:</p>
  
  <pre><code>public class CustomButtonRenderer : Xamarin.Forms.Platform.iOS.ButtonRenderer
      {
          public override void LayoutSubviews()
          {
              foreach (var layer in Control?.Layer.Sublayers.Where(layer =&gt; layer is CAGradientLayer))
                  layer.Frame = Control.Bounds;
              base.LayoutSubviews();
          }
  
          protected override void OnElementChanged(ElementChangedEventArgs&lt;Button&gt; e)
          {
              base.OnElementChanged(e);
  
              if (e.OldElement == null)
              {
                  var gradient = new CAGradientLayer();
                  gradient.CornerRadius = Control.Layer.CornerRadius = 10;
                  gradient.Colors = new CGColor[]
                  {
                      UIColor.FromRGB(51, 102, 104).CGColor,
                      UIColor.FromRGB(51, 202, 204).CGColor
                  };
                  var layer = Control?.Layer.Sublayers.LastOrDefault();
                  Control?.Layer.InsertSublayerBelow(gradient, layer);
              }
          }
      }
  </code></pre>
  
  <p>How can I do the same thing in Android?</p>