Can i bind an error message to a TextInputLayout? : <p>I would like to bind a error message directly to a <code>android.support.design.widget.TextInputLayout</code>. I cannot find a way to set the error through the layout. Is this even possible?</p>

<p>This is how I imagined it working:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"&gt;
    &lt;data&gt;
        &lt;import type="android.view.View" /&gt;
        &lt;variable
            name="error"
            type="String" /&gt;
    &lt;/data&gt;
    &lt;android.support.v7.widget.LinearLayoutCompat
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"&gt;

        &lt;android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:errorEnabled="true"
            app:errorText="@{error}"&gt;
            &lt;EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/username"
                android:inputType="textEmailAddress" /&gt;
        &lt;/android.support.design.widget.TextInputLayout&gt;
    &lt;/android.support.v7.widget.LinearLayoutCompat&gt;
&lt;/layout&gt;
</code></pre>
