Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EditText warning in android app development

Tags:

android

While declaring EditText in xml file, I was warned exactly as given below

No label views point to this text field with an android:labelFor="@+id/@+id/start" attribute

EditText code is

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"        
    android:id="@+id/start"
    android:hint="@string/edit_message" />
like image 860
cool_dude Avatar asked Oct 07 '13 17:10

cool_dude


People also ask

How do I show errors in EditText?

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.

What is the use of EditText in android?

A EditText is an overlay over TextView that configures itself to be editable. It is the predefined subclass of TextView that includes rich editing capabilities.

What is EditText a subclass of?

Android EditText is a subclass of TextView. EditText is used for entering and modifying text. While using EditText width, we must specify its input type in inputType property of EditText which configures the keyboard according to input. EditText uses TextWatcher interface to watch change made over EditText.

How can I tell if EditText is clicked android?

You can use View. OnFocusChangeListener to detect if any view (edittext) gained or lost focus. This goes in your activity or fragment or wherever you have the EditTexts.


1 Answers

I also had no idea what this error message was trying to inform me to do!

Thankfully I found an explanation: http://thecodeiscompiling.blogspot.com/2013/12/android-labelfor-waning-fix.html

the warning is telling you the EditText field does not have a TextView that can be read to a user when accessibility is turned on, since you haven't specified one with the android:labelFor attribute.

like image 149
Someone Somewhere Avatar answered Oct 07 '22 02:10

Someone Somewhere