Customizing TextInputLayout – Part 2

In previous article Customizing TextInputLayout – Part 1, we learnt how to customize TextInputLayout and how to apply hint color to it.

Going to next step of TextInputLayout, in this article we are going to customize this widget by applying custom Typeface to it.

Change Typeface of TextInputLayout

First what you need to do is, download some decent fonts online. You can also use fonts which I have used in demo by downloading it from here.

After downloading fonts, open your file. Actually there is no any method to apply custom fonts in XMl layout file. So we need to patch some part of TextInputLayout to apply custom font.

Declare objects and assign ids to them. Here, in my demo, I took 3 TextInputLayout and apply ids like below.

In your activity, code will be like

After declaring objects, you need to write following method inside your activity. Copy paste below code.

All things are done to apply Typeface to TextInputLayout. We have objects, we have typeface files and we have method to apply font. So simply write below single line of code to apply font to TextInputLayout.






The source code for this article is available here


In this article, we learnt how to apply custom Typeface to TextInputLayout. You can apply any Typeface to as per your need.

Share on Facebook4Share on Google+0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on Tumblr0Email this to someone