在包“ android”中找不到属性“ accessibilityEventTypes”的资源标识符
作者:互联网
我正在尝试与JellyBean一起使用accessibilityEvent.
我曾经使它可以在Android 2上使用,但我想他们改变了Jelly Bean的功能.
我在这里找到了修复它的方法,它是这样的:
在清单中:
<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中设置项目构建目标
标签:accessibility,android 来源: https://codeday.me/bug/20191031/1977730.html