2011-09-07 91 views
0

當我嘗試將以下statelistdrawable設置爲我的某個視圖的背景時,我不斷收到錯誤。我已經清理了該項目並重新啓動了Eclipse,但一切都無法啓動。我甚至無法從Android開發者網站獲取的例子之一,但,不能正常工作...StateListDrawable無法在Eclipse中解析?

我statelistdrawable(「honeycomb.xml」)

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:drawable="@drawable/pointselector" 
     android:state_activated="true" 
     android:state_pressed="true" /> 
    <item android:drawable="@drawable/pointselectorunselect" /> 
</selector> 

錯誤的Eclipse給我:

org.xmlpull.v1.XmlPullParserException: Binary XML file line #4: <item> tag requires a 'drawable' attribute or child tag defining a drawable 
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:178) 
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:832) 
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:769) 
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:208) 
at com.android.layoutlib.bridge.android.BridgeTypedArray.getDrawable(BridgeTypedArray.java:731) 
at android.view.View.<init>(View.java:2450) 
at android.widget.TextView.<init>(TextView.java:371) 
at android.widget.TextView.<init>(TextView.java:364) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
at java.lang.reflect.Constructor.newInstance(Unknown Source) 
at android.view.LayoutInflater.createView(LayoutInflater.java:576) 
at com.android.layoutlib.bridge.android.BridgeInflater.onCreateView(BridgeInflater.java:84) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:644) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669) 
at (...loads of other stuff) 

回答

0

地方您的xml文件即honeycomb.xml到繪製folder.That的足夠..

+0

它已經是!:/ –

0

你確定,這個「@drawabl E/pointselector」,而這種‘@繪製/ pointselector’出現在你的繪製文件夾,我認爲這是你的問題

你可能把他們安置在繪製-MDPI什麼 把他們繪製的文件夾