Search code examples
androidimageaccessibility

What is android:contentDescription="@string/desc" in ImageView's xml?


I added an imageView in GraphicalLayout but it looks different on my real device than on AVD.

I found that I need to add contentDescription in a layout .xml, but when I add: contentDescription="@string/desc"

there is an error:

"No resource found that matches the given name (at 'contentDescription' with value '@string/desc')"

What is this string "desc"? What should it looks like?


Solution

  • You need to add it in your string.xml file:

    <string name="desc">your desc goes here</string>
    

    Although I don't know why you NEED to add contentDescription to your imageView to solve the inconsistent look problem! I don't think this will solve it.