Customizing TextInputLayout – Part 1

customizing textinputlayout

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.

You may also like to read

NFC Mifare UID (Card Serial Number) reverse issue ... If you are using NFC (Near Field Communication) Mifare in your application, you should be careful while using NFC Mifare UID  (Unique IDentification ...
Android 6.0 “M” – new features r... Google is providing a newer version of Android OS each year. This time also we are expecting a newer version of Android 6.0 by the end of this year. ...
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 t...
MaxHeightScrollView in Android using Android Studi... In Android, there are two constants for providing height and width of any view. But if you provide any specific height to any view, it won't be change...
Share on Facebook10Share on Google+2Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on Tumblr0Email this to someone