How to fix a warning in android layout.xml: "missing contentDescription"
<ImageView style="@style/LoaderPrevNext.Next" />
using styles
<style name="LoaderPrevNext">
<item name="android:layout_width">40dp</item>
<item name="android:layout_height">80dp</item>
<item name="android:layout_weight">0</item>
<item name="android:scaleType">fitXY</item>
</style>
<style name="LoaderPrevNext.Next">
<item name="android:src">@drawable/next_page</item>
<item name="android:contentDescription">@string/img_desc_next_page</item>
</style>
annoying me with a warning [Accessibility] Missing contentDescription attribute on image.
It disappears if I move or copy the description of the content from the style to the ImageView tag, but since src is defined in the style, I would like to save them together.
Guess this is just an SDK bug, but some might get a workaround ...
Clarification: The ImageView in question has a content description defined in the style of LoaderPrevNext.Next. The warning is false. I'm not interested in ideas on how to establish a description of the content or how to crack it.
Android contentDescription
, , . contentDescription. , contentDescription - , , .
, contentDescription. , , .
Android lint - , IMO, contentDescription lint :
, , - , . lint
tools:ignore="ContentDescription".
lint:
contentDescriptionXMLandroid:contentDescription="Your description here.", . ,tools:ignore="ContentDescription".