Android HelloTabWidget issue
I am attempting to run the HelloTabWidget example from here:
http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
I am able to build, but once it runs it force closes. I ran the debugger in Eclipse and it looks like the error I am getting is in the res/drawable/ic_tab_artists.xml file.
The error I am getting is: "org.xmlpull.v1.XmlPullParserException: Binary XML file line #4: tag requires a 'drawable' attribute or child tag defining a drawable"
This is the xml I have for it, pretty straightforward:
<?xml version="1.0" encoding="UTF-8"开发者_Python百科?>
<selector xmlns:android="http//schemas.android.com/apk/res/android">
<!-- When selected, use grey -->
<item android:drawable="@drawable/ic_tab_artists_grey" android:state_selected="true" />
<!-- When not selected, use white-->
<item android:drawable="@drawable/ic_tab_artists_white" />
</selector>
I'm just confused because the drawable attribute is there...any ideas? The code/XML I have in my implementation is verbatim what they have in the examples, but it just won't run in the emulator.
<selector xmlns:android="http//schemas.android.com/apk/res/android">
You are missing a colon after http. Perhaps that is the source of the error?
I'm just confused because the drawable attribute is there...any ideas
The only thing I came come up with on why you would get that error is that there's a typo in xmlns:android="http//schemas.android.com/apk/res/android"
or a typo in android:drawable
, but I don't see a typo in either.
If there were a typo in the
xmlns:android=
decl, then theandroid:drawable
attribute initem
wouldn't be the rightdrawable
attribute, so the run-time would say it isn't there.If there were a typo in
android:drawable
, then the run-time error is right: there literally is nodrawable
attribute initem
.
精彩评论