Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Custom Renderer for Span

$
0
0

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(); } }

}


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>