NSAttributedString but for UWP and Android?

Im currently working on a Xamarin app that implements Android, IOS and UWP.
I need a Label that can combine images(Images are stored in the phone, so no worries about downloading them) and text similar to what I see in NSAttributedString for IOS.
However, i dont know what to use for UWP and Android, is there anything that is remotely similar to what is available in IOS? Or do i have to implement a custom renderer for it?
I was thinking of using an HTML approach for this, but i'd like to hear some options first.

Answers

  • JohnHardmanJohnHardman GBUniversity mod

    @albertoha94

    For a portable approach, I would use HTML in a WebView.

    If you were to go the custom renderer route, you could look at RichTextBlock on UWP. I'd have to Google what it would be on Android, but I expect somebody else would know if you don't Google it first.

  • JohnHardmanJohnHardman GBUniversity mod

    @albertoha94

    Just looking at the info about XF pre-release 4.3.0 pre2, one of the highlights is described as "HTML content type support for Label". It will be interesting to see how flexible that HTML support is. It might just do what you want... (or it might not, of course).

    See https://forums.xamarin.com/discussion/169920/pre-release-xamarin-forms-4-3-0-pre2#latest

  • albertoha94albertoha94 Member ✭✭
    edited October 11

    @JohnHardman
    From what i've gathered, for each platform would be the following:
    iOS: NSAttributedString
    UWP: RichTextBlock
    Android: SpannableString.

    I definitely like the idea of HTML, my doubt is that this label will be used in a table with many other of the same, could doing this in HTML be performance heavy on the app? Would doing it with the other options be lighter?

  • JohnHardmanJohnHardman GBUniversity mod

    @albertoha94 said:
    could doing this in HTML be performance heavy on the app? Would doing it with the other options be lighter?

    The other options could be lighter, but a lot more development and testing involved, and in reality the only way to know which is most performant is to try both and time them.

Sign In or Register to comment.