开发者

Hello Views/Form Stuff/Custon Button tutorial error

Flush with success on getting "hello Android" to run, I'm working on the tutorial at link text using Eclipse. When I create the android_button.xml file in res/drawable/, I get errors for each of the in

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/android_pressed"
          android:state_pressed="true" />
    <item android:dra开发者_如何学Cwable="@drawable/android_focused"
          android:state_focused="true" />
    <item android:drawable="@drawable/android_normal" />
</selector>

The errors (repeated for each item) are:

Description Resource    Location    Type    Path
error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/android_focused'). android_button.xml  line 5  Android AAPT Problem    /HelloFormStuff/res/drawable
error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/android_focused'). android_button.xml  line 5  Android AAPT Problem    /HelloFormStuff/res/drawable

I'm afraid I don't know which resource should match the names or if I have overlooked something or misnamed something. Help resolving this is greatly appreciated!


You probably missed this line in the instructions:

Copy the images on the right into the res/drawable/ directory of your project. These will be used for the different button states.

Just copy those little android icons into the directory and it should work


On the link you gave there are three android icons near android_button.xml code. Just right click them and "save as"

Save them in your res/drawable directory along with android_button.xml.

note that I assume you are creating that xml file in res/drawable directory and note in drawable-XXXX directory created by eclipse. You will have to manually create a new folder drawable in res directory, since its not default eclipse stuff.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜