Reputation: 201
Missing accessibility label: where
minSdk < 17
, you should provide anandroid:hint
Editable text fields should provide anandroid:hint
or, provided your minSdkVersion is at least 17, they may be referenced by a view with aandroid:labelFor
attribute. When usingandroid:labelFor
, be sure to provide anandroid:text
or anandroid:contentDescription
. If your view is labeled but by a label in a different layout which includes this one, just suppress this warning from lint.Issue id: LabelFor
How can fix this warning?
Upvotes: 18
Views: 45953
Reputation: 12244
You can specify your lint checking preferences in the lint.xml file. If you are creating this file manually, place it in the root directory of your Android project. Learn More on Documentation
<?xml version="1.0" encoding="utf-8" ?>
<lint>
<issue id="ContentDescription" severity="ignore" />
</lint>
Or inside of ImageView or xml element you can also add:
android:importantForAccessibility="no"
Upvotes: 2
Reputation: 143
Android wants you to help user. Just set a hint :
for example:
android:hint="@string/my_edittext"
Upvotes: 1
Reputation: 5
Add some hint to the "hint" in attributes of the "Text object"(e.g. "Plain Text").
or you don't want to add hint. Just add:
tools:ignore="LabelFor"
in xml(activity_main.xml) code to ignore the warning.
Upvotes: 0
Reputation: 493
Depending on what kind of widget you get this error on, you can choose a suitable label for it so that it will be "more" accessible.
For example, I have an AutoCompleteTextView
, which has no Hint/text, etc. so it is not easy for everyone to notice it, therefore I add a hint like "enter your text here"
which works as "HEY I AM HERE, COME Use me!"
You can add a text like
android:text="@string/default_lat"
,
hint like
android:hint="@string/SomeHint"
or label like
android:labelFor="SomeLabel"
For more information click this
Upvotes: 4
Reputation: 1
Provide an android:hint Editable text fields should provide an android:hint or, provided your minSdkVersion is at least 17, they may be referenced by a view with a android:labelFor attribute. When using android:labelFor, be sure to provide an android:text or an android:contentDescription. If your view is labeled but by a label in a different layout which includes this one, just suppress this warning from lint.
Upvotes: 0
Reputation: 814
I had I same problem. I fix it like this
Use @String/example for name your method Follow these steps
Go to Res>Values>Stings.xmladd a string like this
Enter Number 1
@String/Enter_Number_1
if required asking of hind just add this code with your hint
android:autofillHints=""
Upvotes: 2