Style item name not being recognized despite being used in Android's own styles.xml
Question
Here's a resource of mine:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme">
<item name="editTextStyle">@android:style/Widget.EditText</item>
</style>
</resources>
Eclipse doesn't like it: "No resource found that matches the given name: attr 'editTextStyle'"
At the same time, if I open Android's own platforms/android-3/data/res/values/themes.xml
, I see that this is clearly being used there:
<resources>
...
<style name="Theme">
...
<item name="editTextStyle">@android:style/Widget.EditText</item>
...
Android documentation encourages to read that very same file to learn about the ins and outs of styling. But how can I actually do the same cool things they do there?
Solution
You need to specify the android
namespace:
<item name="android:editTextStyle">@android:style/Widget.EditText</item>
Also, you probably only want to list the items you are overriding, there is really no point in setting it to the default.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow