5

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" />
Siddharth
  • 9,349
  • 16
  • 86
  • 148
cool_dude
  • 51
  • 1
  • 2
  • Possible duplicate of [Meaning of "No label views point to this text field" warning message](http://stackoverflow.com/questions/16896082/meaning-of-no-label-views-point-to-this-text-field-warning-message) – YEH Nov 29 '15 at 08:23

4 Answers4

3

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.

Someone Somewhere
  • 23,475
  • 11
  • 118
  • 166
2

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

When you drag and drop and Text Fields into Graphical Layout you get this above error .

The generated code looks like this:

<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="31dp"
android:layout_marginTop="154dp"
android:ems="10"
android:inputType="textPersonName" >

<requestFocus />

Solution :
add this label "android:labelFor="@+id/editText1" as shown below .

<EditText
android:id="@+id/editText1"
android:labelFor="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="31dp"
android:layout_marginTop="154dp"
android:ems="10"
android:inputType="textPersonName" >

<requestFocus />
</EditText>
akshaypmurgod
  • 77
  • 1
  • 3
1

Use id like following in your editText.

 android:id="@+id/editText1"

And then if you want to set labelFor then use

 android:labelFor="@id/editText1"
Piyush
  • 2,040
  • 16
  • 14
0

Use android:labelFor="@+id/start" instead of android:id="@+id/start".

Evan Bashir
  • 5,501
  • 2
  • 25
  • 29