Customizing TextInputLayout – Part 1

In previous article TextInputLayout – Material Design Support library Tutorial, we learn what is TextInputLayout and what is functionality of it. How TextInputLayout added a new functionality to EditText. Going to next step of TextInputLayout, in this article we are going to customize TextInputLayout.

In this article, we are going do following things.

  • Changing color of hint of TextInputLayout
  • Change Typeface of TextInputLayout

These two customization are very handy in day life application development. Let starts with first one. Changing typeface will be covered in next tutorial.

Changing color of hint of TextInputLayout

Open your Style.xml file resides in your “Resource” directory. Create a new style with custom name. I provided name="TextAppearence.TextInputLayout.Blue" here. Provide it parent theme as parent="@android:style/TextAppearance".

style has child tag called item. You can use this tag to customize parent style you have extended.

Add following line of code into style tag.

<item name="android:textColor">@color/make_me_blue</item>

After adding above line of code, your style tag will look like this. In this example, I add name="android:textSize" to provide size of hint to TextInputLayout.

Now, open your "activity_main.xml" layout file. You need to add namespace to provide hint color. Write following line of code in root layout to use custom attribute in our layout file.

Now your root layout will look like

That’s it. You are almost near to change color of your hint of TextInputLayout. Add below line of code inside


Your whole widget tag will look like,

I created some more styles and provided to TextInputLayout. You can customize it as per your requirement.

It is time to run our demo. Build and execute it in device.

The source code for this article is available here


In this article, we learned how to apply custom color to hint of TextInputLayout. You can apply any color to hint as per your need.

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