Hello Community,
I created a custom FRAME renderer that creates a gradient background. It works for iOS however in Android the gradient works but none of the child controls inside the frame display. Can someone tell me what I am doing wrong that causes the child controls to not display?
`
protected override void OnElementChanged( ElementChangedEventArgs<Frame> e )
{
base.OnElementChanged( e );
if( e.OldElement != null || Element == null )
return;
Background = GetGradientDrawable();
}
private GradientDrawable GetGradientDrawable()
{
Xamarin.Forms.Color[] gradientColors = new Xamarin.Forms.Color[ 2 ];
gradientColors[ 0 ] = Card.StartColor;
gradientColors[ 1 ] = Card.EndColor;
int[] androidColors = new int[ gradientColors.Length ];
for( int i = 0; i < gradientColors.Length; i++ )
{
Xamarin.Forms.Color temp = gradientColors[ i ];
androidColors[ i ] = temp.ToAndroid();
}
GradientDrawable gradient = new GradientDrawable( GradientDrawable.Orientation.LeftRight, androidColors );
gradient.SetCornerRadii( new float[] { Element.CornerRadius, Element.CornerRadius, Element.CornerRadius, Element.CornerRadius,
Element.CornerRadius, Element.CornerRadius, Element.CornerRadius, Element.CornerRadius } );
return gradient;
}
`
Thank you in advance for the help.
Chris