I would like to disable this warning:
[Accessibility] Missing 'contentDescription' attribute on image
I know the solution android:contentDescription:"@null"
. But I want to be able to do the entire project and not on each of my ImageView.
On documentation of tools android, they advocate to do it like this:
android {
lintOptions {
disable 'TypographyFractions','TypographyQuotes'
...
}
}
My question is what is the name of lint options for this warning "contentDescription attribute on image"?
Edit, My Solution:
Click on Suppress with @SuppressLint (Java) or tools:ignore (XML)
This button add this on your <ImageView .. />
:
tools:ignore="ContentDescription"
So you just need to add this lintOptions on your build.gradle
:
android {
lintOptions {
disable 'ContentDescription'
}
}
I think you can disable it in your gradle config as well.
You can find a list of Lint issues here. If you check it the you can see that it contains the TypographyFractions
and it contains also the ContentDescription
. Please note that I didn't try them but I think it should work.
So in my opinion you should do it in the following way:
android {
lintOptions {
disable 'ContentDescription'
...
}
}
If not mistaken, you can disable them using Android Studio Preferences settings as follows:
Windows -> Preferences -> Inspection -> Uncheck "Image Without Content Description"
Try this tutorial to see how he has forced it to be converted to error. May be altering things here would fix it for you.
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