我正在尝试使用 JellyBean 的 accessibilityEvent。 我曾经让它与 Android 2 一起工作,但我猜他们在 Jelly Bean 中改变了一些东西。 我在这里找到了修复它的东西,它是这样的:
在 list 中:
<service android:name=".MyAccessibilityEventClass" android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter >
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/accessibilityservice" />
</service>
然后他们告诉我创建 fie res/xml/accessibilityservice.xml:
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeNotificationStateChanged"
android:accessibilityFeedbackType="feedbackSpoken"
android:notificationTimeout="100"
/>
但是我在 Eclipse 中编译时遇到了这些错误:
No resource identifier found for attribute 'accessibilityEventTypes' in package 'android'
No resource identifier found for attribute 'accessibilityFeedbackType' in package 'android'
No resource identifier found for attribute 'notificationTimeout' in package 'android'
有什么提示吗?提前致谢
最佳答案
当我的项目构建目标设置得太低时,我遇到了这个问题。当我将它设置为 17 时,错误消失了,我仍然能够向后兼容旧版本的 Android。 From the docs :
You can still build your app to support older versions, but setting the build target to the latest version allows you to enable new features and optimize your app for a great user experience on the latest devices.
你可以在Properties->Android中设置你的Project Build Target
关于android - 在包 'accessibilityEventTypes' 中找不到属性 'android' 的资源标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13185728/