I'm trying to set a custom typeface on the Hint
of a TextInputLayout
. Therefore I'm using a custom subclass of TextInputLayout
with a custom property MyHint
. This property setter should format the text and set the FormattedText
but it doesn't work.
If I simply set the FormattedHint
property it also doesn't format. Does anyone why these approaches are failing?
Below you can see my custom class with property.
Example:
BaseTextInputLayout userNameInput = view.FindViewById<BaseTextInputLayout>(Resource.Id.myId);
userNameInput.MyHint = "My Custom hint text";
Class:
public class BaseTextInputLayout: TextInputLayout
{
public string MyHint
{
get
{
return Hint;
}
set {
if (value != null)
{
SpannableStringBuilder builder = new SpannableStringBuilder(value);
builder.SetSpan(new CustomTypeFaceSpan("", Constants_Android.TYPEFACE_YOGA_MET_EVY_CUSTOMFONT), 0, builder.Length(), SpanTypes.InclusiveExclusive);
this.HintFormatted = builder;
}
else
{
this.HintFormatted = null;
}
}
}