android - 在包“android”中找不到属性 'contentDescription' 的资源标识符

标签 android xml

我在 ImageView 上的“[Accessibility] Missing contentDescription attribute on image”之前收到此警告,然后我将此代码添加到其中:

android:contentDescription="@string/desc"

现在我遇到了一个错误

No resource identifier found for attribute 'contentDescription' in package 'android

这是我的代码:

<ImageView 
            android:id="@+id/handle"
            android:layout_width="48dip"
            android:layout_height="48dip"
            android:contentDescription="@string/desc"
            android:src="@drawable/icon"
           />

最佳答案

您需要将名为 desc 的字符串资源添加到您的项目(例如,res/values/strings.xml)以使用 android:contentDescription 属性。

关于android - 在包“android”中找不到属性 'contentDescription' 的资源标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8869183/

相关文章:

android - 在 Android 应用程序中使用 MediaPlayer 的正确方法

android - 在动画期间更改 ImageView 图像

android - 我如何利用 Android 的 "Clear Cache"按钮

php - 使用PHP导出XML,通过AJAX将其拉入DOM,但xml不可见

android - 在后台打开 WebView

java - 获取单个 xml 节点 - android dev

ruby - Nokogiri/Xpath 命名空间查询

Python lxml创建xml文件时在特定节点之间添加换行符

html - 在 XML 中使用 <br/> 标签进行 XSLT

php - XPath 无效表达式