Home » Android » android – Can't reference Holo theme from values-v11/themes.xml

android – Can't reference Holo theme from values-v11/themes.xml

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m trying to make my app use the Holo Light theme if it is running on a 3.0+ device, but for some reason the values-v11 method isn’t working. I see a bunch of other people apparently using this method, but when I define my theme in res/values-v11/themes.xml:

<resources>
<style name="MainStyle" parent="@android:Theme.Holo.Light">

</style>
</resources>

Eclipse gives me error: Error retrieving parent for item: No resource found that matches the given name '@android:Theme.Holo.Light'. It’s the same whether I use android:Theme.Holo.Light or android:style/Theme.Holo.Light.

My minSdkVersion is set to 10 and my targetSdkVersion is set to 15.

Any ideas?

How to&Answers:

I suspect you should be using parent="@android:style/Theme.Holo.Light". Make sure it’s exactly like this–with the @ sign and everything.

From comments: Also make sure you’ve set your target API (different from the target SDK) in the Project Properties (not the manifest) to be at least 4.0/API 14.

Answer:

Set your Project Build Target above or equal to 14 and make sure you used correct syntax for Theme.Holo.Light.
It should be like this
parent=”@android:style/Theme.Holo.Light”

Answer:

TextAppearance.Holo.Widget.ActionBar.Title appears to have been added in API Level 13. Make sure your build target is set to 13, not just 11.

AndroidManifest.xml:

<uses-sdk
    android:minSdkVersion=...
    android:targetSdkVersion="11" />