EditText added is not a TextInputEditText. Please switch to using that class instead EditText added is not a TextInputEditText. Please switch to using that class instead android android

EditText added is not a TextInputEditText. Please switch to using that class instead


I was wondering this too, Daniel Wilson gathered the documentation, but to the untrained eye it doesn't mean much. Here's what it's all about: "extract mode" is referring to the type of view that's shown when the space is too small, for example landscape on a phone. I'm using Galaxy S4 with Google Keyboard as input method editor (IME).

Landscape UI without visible IME

Based on the focus (on Description) you can see TextInputLayout in action pushing the hint outside the editor. Nothing special here, this is what TextInputLayout is supposed to do.

Landscape UI without visible IME

Landscape UI editing empty Name field

Editing the Name you can see that the IME doesn't give you a hint of what you're editing.

Landscape UI editing empty Name field

Landscape UI editing empty Description field

Editing the Description you can see that the IME gives you a hint of what you're editing.

Landscape UI editing empty Description field

Layout XMLs

The difference between the two fields is their type EditText VS TextInputEditText. The important thing here is that TextInputLayout has the android:hint and not the wrapped EditText, this is the case when TextInputEditText's few lines of Java code makes a big difference.

Name field

<android.support.design.widget.TextInputLayout    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:hint="Item Name"    >    <EditText        android:id="@+id/name"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        /></android.support.design.widget.TextInputLayout>

Description field

<android.support.design.widget.TextInputLayout    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:hint="Item Description"    >    <android.support.design.widget.TextInputEditText        android:id="@+id/description"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:inputType="textMultiLine"        android:minLines="4"        android:scrollbars="vertical"        /></android.support.design.widget.TextInputLayout>


There is no documentation for it, but the class is a regular EditText with a single extra feature:

Using this class allows us to display a hint in the IME when in 'extract' mode.

Specifically it sets the EditorInfo.hintText. You'll notice in the TextInputLayout class you can specify the hint and it's appearance rather than as part of the child EditText widget.

If you need to do that, you should use a TextInputEditText so it pays attention to the hint info you specified in the TextInputLayout.


They are essentially the same thing, but I think the TextInputEditText has more features and possibly attributes. I changed to the TextInputEditText and everything worked and looked as it did before with the standard EditText.