2

I am using TextInputLayout wraps with EditText and i I am using custom fonts. I am able to set typeface on edittext and its working but same font is not working for TextInputLayout Label. How to set font type on TextInputLayout Label?

I have already tried Change font of the floating label EditText and TextInputLayout
But not working at all.

Any suggestion will be helpful.

Community
  • 1
  • 1
Sonali8890
  • 2,005
  • 12
  • 16

1 Answers1

2

As of Design Library v23, you can use TextInputLayout#setTypeface().

This will set the typeface on both the expanded and floating hint.

Feature request where it was discussed on b.android.com.

Austyn Mahoney
  • 11,398
  • 8
  • 64
  • 85
  • How about from XML? and Does it work only with Android Fonts? Or any fonts? – Dr.jacky Oct 01 '16 at 15:20
  • 2
    I haven't tried, but the linked docs don't list an XML attribute for `typeface`. It will work with any font you can read into an Android `Typeface` object. https://developer.android.com/reference/android/graphics/Typeface.html – Austyn Mahoney Oct 11 '16 at 20:54
  • For some reason its only working for TextInputEditText with android:inputType="textPassword". – Lester Jan 23 '18 at 13:17