Search code examples
androidlayoutandroid-textinputlayout

Measure height of TextInputLayout error container


Hi I have to make layout as below, edit text has to be in TextInputLayout to have error and floating hint functionality, and spinner on the right must have underline. My question is how to do it, because when I'm adding EditText into TextInputLayout there is a padding bellow and both underlines aren't in the same line. Is it possible to measure somehow this error container height? enter image description here


Solution

  • So there are two possibility to do this:

    1. Set errorEnabled as false and create custom TextView with error text.
    2. Add extra invisible TextView to the bottom of second view with style and font size which can be found in TextInputLayout constructor. I'm not using this method but in my case it is 12sp.