I'm using an EditText
inside a TextInputLayout
, but after upgrading the support library to 23.2.0, I get this warning in the logcat, What's the difference between a regular EditText
and a TextInputEditText
? I can't seem to find any documentation for it.

- 8,097
- 7
- 30
- 33
-
i have upgraded my support library to 23.2.1 but still **TextInputEditText cannot be resolved in my code** . how did you Resolve it? – Edijae Crusar Apr 09 '16 at 13:59
5 Answers
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 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 Description field
Editing the Description you can see that the IME gives you a hint of what you're editing.
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>

- 27,862
- 20
- 113
- 121

- 44,762
- 26
- 170
- 254
-
3i have upgraded my support library to 23.2.1 but still **TextInputEditText cannot be resolved in my code .** how did you Resolve it? – Edijae Crusar Apr 09 '16 at 14:04
-
-
1Quick note: according to the docs, the `android:hint` property is supposed to go in `TextInputEditText` instead of `TextInputLayout`. – DriesOeyen Apr 26 '16 at 12:53
-
@DriesOeyen It works both ways, I think it's more clear on the outer layout, because on the UI it's the `TextInputLayout` that renders the hint and not the `*EditText`. If you check the code of `TextInputLayout.setEditText` you can see that it actually "steals" the hint and then clears it. That's why we need to use `TextInputEditText` which "steals" it back to be displayed in IME. *Interesting design...* – TWiStErRob Apr 26 '16 at 17:19
-
-
@luxsypher Same response... that class is in package `android.support.design.widget` as you can see in XML, to use it you need [Design Support Library](http://developer.android.com/tools/support-library/features.html#design), it's not in [v7 appcompat](http://developer.android.com/tools/support-library/features.html#v7). If this is not the issue I suggest creating a new question on SO. – TWiStErRob May 12 '16 at 10:10
-
@TWiStErRob am using `com.android.support:design:23.2.1` but still TextInputEditText could not be resolved. i ended up dropping it and using the other way which is **putting EditText in a TextInputLayout** – Edijae Crusar May 13 '16 at 05:46
-
1@luxsypher i ended up dropping it and using the other way which is **putting EditText in a TextInputLayout** – Edijae Crusar May 13 '16 at 05:48
-
-
@gikarasojokinene I ended up doing the same, going back to a EditText and I ignore the warning – Damien Locque May 13 '16 at 08:07
-
If I `type caste` the `TextInputEditText` to `EditText ` which are the cases where it can create problem ? TIA – jeet.chanchawat Nov 09 '16 at 05:22
-
1@jeet.chanchawat it's an upcast, so it's safe. You should always use the most general type that provides you the functionality (=API) needed. Using `TextInputEditText` is an implementation detail of the UI. – TWiStErRob Nov 09 '16 at 10:08
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
.

- 18,838
- 12
- 85
- 135
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
.

- 2,572
- 2
- 22
- 38
-
I already use TextInputLayout, I'm asking about an alternative to the EditText called TextInputEditText – Silvia H Mar 03 '16 at 15:21
-
Sorry, I was talking about the TextInputEditText but said layout. I edited the answer – Nick Mowen Mar 03 '16 at 15:22
The only difference is that when your device is in landscape mode, TextInputEditText
will show the hint, EditText
won't.

- 7,597
- 2
- 40
- 73
I had this problem and just deleted this line in my xml file:
android: fitsSystemWindows = "true"
and the error disappeared.

- 134,786
- 31
- 255
- 325

- 11
- 1
- 1