This is brilliant Martin, thank you very much! It’s unbelievable how messy it is to just style a TextInputLayout, it would have taken me days without your guide. Google sometimes really likes to complicate our lives.

As an addition, if you need to use a different colour for the TextInputEditText when it is focused (and it doesn’t correspond with your primaryColor), you can set a ColorStateList which takes care of the following states:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="">
<item android:color="@color/yourFocusedColor" android:state_focused="true"/>
<item android:color="@color/yourUnfocusedColor" android:state_focused="false"/>

Android Tech Lead & clean code advocate

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store