I am trying to set a custom font on Hint for TextInputLayout . Therefore, I use my own subclass of TextInputLayout with the custom property MyHint . This property installer should format the text and set FormattedText , but it does not work.
If I just set the FormattedHint property, it also does not format. Anyone why these approaches fail?
Below you can see my own class with a property.
Example:
BaseTextInputLayout userNameInput = view.FindViewById<BaseTextInputLayout>(Resource.Id.myId); userNameInput.MyHint = "My Custom hint text";
Grade:
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; } } }
source share