2012-11-01 48 views
3

我正在嘗試與JellyBean一起使用accessibilityEvent。 我曾經使它與Android 2的工作,但我想他們改變了果凍豆的東西。 我發現這裏的東西來修復它,它是這樣的:在'android'包中找不到屬性'accessibilityEventTypes'的資源標識符

在清單:

<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> 

然後他們告訴我創造了外商投資企業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' 

任何提示?在此先感謝

+0

Hmm..are你確定你設定正確的目標和minSDK版本?這是我通常得到這些類型的錯誤的唯一原因 –

+0

嗯,我有這個: Ton

回答

2

我有這個問題時,我的項目建設目標定得太低。當我將它設置爲17時,錯誤消失了,我仍然可以向後兼容較舊版本的Android。 From the docs

你仍然可以構建應用程序來支持舊版本,但構建目標設定爲最新版本,您可以啓用新功能和優化您的應用程序爲最新設備出色的用戶體驗。

你可以設置你的項目構建目標的屬性 - > Android的

2

對不起,我固定的改變schemas.android.com爲Schemas.android.com(首都S)

<accessibility-service xmlns:android="http://Schemas.android.com/apk/res/android" 
相關問題