Custom Renderer for Span

Pedro_PazPedro_Paz Member ✭✭

Hello devs!

I'm trying to make a Custom Renderer to ignore the ****android**** accessibility configurations in the ****Span Class****, to ****not re-scale the font size****.
I have made successfully renderer for the Label class but not for Span class.. Can someone help me? :D

****My Label Custom Renderer is Above!****
<br /> using System;<br /> using System.ComponentModel;<br /> using Android.Widget;<br /> using FreePlay.Droid;<br /> using Xamarin.Forms;<br /> using Xamarin.Forms.Platform.Android;</p> <p>[assembly: ExportRenderer(typeof(Span), typeof(IgnoreAcessibilitySpan))]<br /> namespace FreePlay.Droid<br /> {</p> <pre><code>public class IgnoreAcessibilitySpan : LabelRenderer { protected void setFontSizeAgain() { var nativeControl = (TextView)Control; var xfControl = Element; //e.NewElement; if (nativeControl != null && xfControl != null) nativeControl.SetTextSize(Android.Util.ComplexUnitType.Dip, xfControl.Font.ToScaledPixel()); } protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Label> e) { base.OnElementChanged(e); setFontSizeAgain(); } protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); setFontSizeAgain(); } }

}

Answers

Sign In or Register to comment.