When creating a stateful drawable, I cannot find the other drawables (9-patch images) that are there - i get no "suggestions" ("intelliSense").
But if I try to find drawables in another XML-file there is no problem.
this is my stateful drawable
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/view_background_开发者_StackOverflowpressed" />
<item
android:state_focused="true"
android:state_pressed="false"
android:drawable="@drawable/view_background_normal" />
<item
android:state_focused="false"
android:state_pressed="true"
android:drawable="@drawable/view_background_pressed" />
<item
android:drawable="@drawable/view_background_normal" />
</selector>
the "view_background_pressed" etc are all there, and they can be found in other XML-files but not in the statefule drawable.
Any ideas?
It's quite possible that it's just Eclipse being funny. Have you tried cleaning the project from Project → Clean?
Or restarting Eclipse?
You can also check the output of aapt
to check that there isn't a subtle resource compilation problem somewhere that you're missing.
You can enable more output in the Eclipse console by going to:
Preferences → Android → Build → Build output → Verbose
Then, as you execute a build (or Eclipse attempts to build automatically), you'll see the aapt
output in the Console view (you may need to select the Android sub-console).
If you wan't to use custom shapes you need to make them in the same XML like this:
<?xml version="1.0" encoding="utf-8"?>
<item android:state_pressed="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/lichtblauw"/>
<corners
android:radius="5dp"/>
<stroke
android:width="1px" android:color="@color/donkergrijs" />
</shape>
</item> <!-- pressed -->
<item android:state_focused="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/lichtblauw"/>
<corners
android:radius="5dp"/>
<stroke
android:width="1px" android:color="@color/donkergrijs" />
</shape>
</item> <!-- focused -->
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/blauw"/>
<corners
android:radius="5dp"/>
<stroke
android:width="1px" android:color="@color/donkergrijs" />
</shape>
</item> <!-- default -->
精彩评论