Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning on EditText

I'm trying to define an EditText but this warning is shown:

This text field does not specify an inputType or a hint.

The code in main.xml is:

<EditText android:id="@+id/input" 
              android:layout_width="fill_parent" 
              android:layout_height="wrap_content" 
              android:text="@string/textTest" /> 

How can I fix it?

like image 419
Jjreina Avatar asked Feb 24 '12 18:02

Jjreina


People also ask

How do I show error in TextInputLayout?

You can use the TextInputLayout to display error messages according to the material design guidelines using the setError and setErrorEnabled methods. In order to show the error below the EditText use: TextInputLayout til = (TextInputLayout) findViewById(R. id.


1 Answers

You could add a hint :

android:hint="This will appear to the user if he didn't enter something yet in the EditText"

and a inputType so you could present to the user a better suited soft keyboard for the text he is suposed to enter in the EditText:

android:inputType="number"

will present a soft keyboard with only numbers and various signs.
Those are just warnings, you could ignore them but is better for the user to implement them.

like image 54
user Avatar answered Sep 22 '22 06:09

user