'Missing contentDescription attribute on image' in XML

后端 未结 9 2212
挽巷
挽巷 2020-11-28 17:49

I get an warning about [Accessibility]Missing contentDescription attribute on image in eclipse. This warning show at line 5 (declare ImageView)

9条回答
  •  余生分开走
    2020-11-28 18:34

    Updated:

    As pointed out in the comments, setting the description to null indicates that the image is purely decorative and is understood as that by screen readers like TalkBack.

    Old answer, I no longer support this answer:

    For all the people looking how to avoid the warning:

    I don't think android:contentDescription="@null" is the best solution.

    I'm using tools:ignore="ContentDescription" that is what is meant to be.

    Make sure you include xmlns:tools="http://schemas.android.com/tools" in your root layout.

提交回复
热议问题