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

TextFormatted not showing on Android custom button renderer

$
0
0

Hello,

I have the property being set on methods OnElementChanged and OnElementPropertyChanged in the same away but it does not work on the first. So, no button title is displayed at first, unless the value changes.

Upon using Inspector to check it out, the property is not set "on creation", having an empty Java.Lang.String as its value. Whereas after the call to OnElementPropertyChanged, the property value is correctly set to a SpannableString.

How I set its value on both methods:
var spannableString = formattedToSpannable(formsControl.FormattedText); Control.TextFormatted = spannableString;

The converter method:
SpannableString formattedToSpannable(FormattedString item) { var textView = new Android.Widget.TextView(Control.Context); var spanned = item.ToAttributed(Font.Default, Xamarin.Forms.Color.White, textView); return spanned; }

Any ideas on how to get it working?

Thanks is advance.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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