I have defined a theme in values/themes.xml:
<resources>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light.NoActionBar">
</style>
</resources>
and in my AndroidManifest.xml I have:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
The code is compiled and I see the proper result, but IDE tells me it cannot resolve symbol #android:style/Theme.Holo.Light.NoActionBar. Please advice why.
I have the same problem, try to change the android compiling libraries to the 3.2 Android version. It will let you use this themes and should be compatible with previous versions.
Be careful with the API you use. Despite of this you can set your minSdkVersion to 8.
Your minSdkVersion is too low for the Holo theme. The Holo theme is only available on SDK 11 (Honeycomb) and later. You may want to look at ActionBarSherlock. Since it looks like you're not using the action bar, you could also put separate themes.xml files in values and values-v11.
Related
I recently updated Android Studio to version 1.2 and my AppCompat library to v22.0.0, SDK-Build-Tools version to 22.0.1. My target and compile sdk-version is 22 and my 'min-sdk-version' is 16.
The problem I am having is that in the xml-layout preview, I am getting an error namely: "Rendering Problems, the following classes cannot be found: android.support.v7.widget.Toolbar". I did some surfing on the internet and tried the already provided solutions. They are as follows:
Changing my (xml) preview to show android version target 21 or Android 5.0.1, 19, and 17
Changing my styles theme to Holo.NoActionBar and other themes as well.
Changing my minSdkVersion to 21 (above 20 basically)
Restarted Android Studio... Twice
Built the project about 5 times.
However, the problem still remains and I'm out of ideas. Could really use some help here. Thanks...
Also: The classes import just fine in my java file. It's just the preview.
EDIT: The preview works fine when I use android.widget.Toolbar. And my DrawerLayout doesn't work. I'm guessing there's something wrong with rendering the widgets from the support libraries?
I had a similar problem and you may want to try to change the app theme in the style.xml to an appcompat app theme for example with mine I changed it to something like this.
<style name="AppTheme" parent="#style/Theme.AppCompat.NoActionBar">
<item name="windowActionBar">false</item>
<!-- Customize your theme here. -->
</style>
and then go to the Android Manifests file
<application
android:theme="#style/whatever_you_named_your_app_theme">
In the Android Manifests file you write whatever you wrote in the styles.xml under <style name=""
There is no need to lower your apps targetSDK.
Give me feedback if it worked for you
I wiped out my entire project and started all over again. That seemed to solve the problem. I'm guessing changing my configurations in between is what caused the mess. Thank goodness the project was just for recreation.
I have created a project with following settings for Target :
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
But following error persists at values-v11 and values-v14:
ERROR : No resource found that matches the given name 'android:Theme.Holo.Light'
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
Assuming you're using Eclipse, you need to right-click your project in the Package Explorer, select Properties, select Android, and set Project Build Target to API level 14 or higher. Or equivalently, set target=android-14 or higher in your project's project.properties file, but note that this file is autogenerated by Eclipse, so manually editing it is not recommended.
First there is problem in the parent attribute, you have to use parent="android:style/Theme.Holo.Light"
Second, Since Holo Theme was introduced in API level 14... so you have to change your android:minSdkVersion="8" to android:minSdkVersion="11", On newer versions it will automatically use Holo theme. You can further read about Holo Theme at
On Android Developers Blog
on Developers.Android.com
However if you want to support previous versions of Android for Holo Themes. You can use Holoeverywhere library.
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" />
you can Click Properties of this project and click Android,chose Target Name byond you aim project.
In my android app, we need to support everything from Gingerbread to Jelly Bean. In my stylesheets, I need to have 2 versions of some fields, for example:
<item name="popupMenuStyle">#style/PopupMenu.MyTheme</item>
<item name="android:popupMenuStyle">#style/PopupMenu.MyTheme</item>
The issue is that with a minSdkVersion of 8, the "android:" version of the fields don't compile, but without them, the styles don't get applied in the later OS's.
Is there a switch I have to check for in the XML file?
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
Compile your code against targetSdkVersion(api 17), It will solve the problem.
Update
you can create folders in /res like values, values-v11, values-v14, there you can add themes related to different api levels. On device < API 11, theme will be selected from 'values', similarly devices gaving api 11 or above will get theme from 'values-v11' etc
Being in Eclipse editing the AndroidManifest.xml the compiler shows me suggestion to add #android:style/Theme_Holo. But when compiling I get the message:
Error: No resource found that matches the given name (at 'theme' with value '#android:style/Theme_Holo')
Is there something wrong with my settings?
Introduced in Honeycomb.
android:theme="#android:style/Theme.Holo"
The holographic theme is new in Honeycomb (SDK level 11). If your project level is set below that, the theme won't be found. (Also note that the graphical layout editor can be set to a higher level than your project setting.)
Had the same error message showing up in the res/values-v11 and res/values-v14 folders of my Android project.
Solved it by setting the AndroidManifest.xml android:targetSdkVersion higher until it matched a version where the theme was available.
Example:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
Works fine for:
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
Also might have to modify the target=<android:sdk-version> line within the project.properties text file.
I currently have an Android application targeting version 11 of the SDK with a minimum version of 4. I would like to apply the Light version of the Holo theme if the app is running on Honeycomb. Following the instructions here I have tried adding the following to res/values-v11/themes.xml but my application will not compile because #android:style/Theme.Holo.Light does not exist in SDK 4
<resources>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light">
</style>
</resources>
Is is possible to get a reference to that theme without having to build separate 1.6-2.x and 3.x versions of my application?
As EboMike pointed out in the comments this was a problem with setting the build target to the Minimum SDK version instead of the Target SDK version.