I have an EditText
in my xml and I get this warning
No label views point to this text field with an android:labelFor="@+id/@+id/et_password" attribute
I have searched in SO and I found these posts but unfortunately I don't find any answer that explains the reason of getting this warning.
1- Meaning of "No label views point to this text field" warning message
2- EditText warning in android app development
Here is my xml code:
<LinearLayout
android:id="@+id/ll_password"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/tv_password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:text="@string/tv_password" />
<EditText
android:id="@+id/et_password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:background="@color/background"
android:gravity="start|center_vertical"
android:inputType="textPassword"
android:singleLine="true" />
</LinearLayout>
I don't know why I'm getting this warning. What I have done so far:
1- I tried changing my EditText
id
2- Removing TextView
in my layout
But warning still remain.
I just wondered because I have the same LinearLayout
for my username without any warning.
Am I doing wrong? And what's the reason I'm getting this warning?
Three chance in my point of view
1) It might be you have done something wrong with the id of the components.Use id
like follows.
android:id="@+id/editText1"
2 ) You should not have plus sign in the labelFor
id. It should be: android:labelFor="@id/editText1"
The plus sign is only used once to generate the id.
3) This error will show in the XML if you simply drag a Multiline Text
into a layout.
See this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With