Letter Spacing label in Xamarin Forms
One of the limitations of the Label
control in Xamarin Forms is that it’s missing a letter spacing property. On one of our most recent Forms projects we needed to specify differing letter spacing on some labels so I’ve put together a few code samples to save you time on how to do this in your iOS and Android renderers.
Forms control
The forms control is as easy as they come, it requires just one property which we’ve made a float
:
I’ve named the control the LetterSpacingLabel
.
The real magic happens in the iOS and Android renderers.
Android renderer
The Android renderer code looks like:
iOS renderer
The following code example demonstrates using the LetterSpacingLabel
control:
The following screenshots show the label on each platform:
Repo for LetterSpacingLabel can be found on Github.