Error: No resource found that matches the given na

2020-07-24 04:36发布

问题:

I am trying to theme my default listview theme. I have read a lot of stuff on the web and they are all saying this should work:

<style name="Theme.MyTheme" parent="@style/Theme.Sherlock.Light">
    <item name="textColor">@color/darkblue</item>
    <item name="listViewStyle">@style/MyListViewTheme</item>
</style>

with this theme for the ListView:

<style name="MyListViewTheme" parent="@android:style/Widget.ListView">
    <item name="android:textColor">@color/darkblue</item>
    <item name="android:typeface">sans</item>
</style>

Unfortunately, I get this error:

Error: No resource found that matches the given name: attr 'listViewStyle'.

I really don't understand why I cannot use listViewStyle attribute.

Source:

http://brainflush.wordpress.com/2009/03/15/understanding-android-themes-and-styles/

http://www.devdaily.com/java/jwarehouse/android-examples/platforms/android-2/data/res/values/themes.xml.shtml

回答1:

I feel so stupid!

<item name="android:listViewStyle"> 

instead of

<item name="listViewStyle">