Inherit from #android:style/Theme.Holo.Light in a minSdkVersion="4" application - android

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.

Related

Difference between styles.xml (res\values\styles.xml) and styles.xml (res\values-v21\styles.xml)?

What is the main difference between these two files : styles.xml (res\values\styles.xml) and styles.xml (res\values-v21\styles.xml ?
For targeting old android versions, which file should we modify?
Android will use res\values-v21\styles.xml if the user's device is running Android API level 21+ (Android 5.0+) & will use res\values\styles.xml for older versions
It just means that the styles differ in android versions.
styles.xml in values-v21 mean that, that particular style is for Android API 21 version 5.0+
while styles.xml will be for any other Android version besides 5.0+.
its the same as language where you create an activity for en, fr, pk etc.
Older version would automatically be targetted by the values/styles.xml file.

Rendering Problems - Following Classes Not Found

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.

No resource found that matches the given name 'android:Theme.Holo.Light'

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.

Getting errors when i change build target back to 2.3.3

Getting errors in style.xml when i change build target to 2.3.3, I think i need to change the theme from holo to something but i don't know any theme names
Here the line where the errors are
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
Holo theme is not supported for old android versions. A quick option could be this
<style name="LightThemeSelector" parent="#android:style/Theme.Light">
...
</style>
More Themes Info
if you are using advanced features like action bar..etc there is one library project called SherlocActionBar you can try with this

Android Styles and Values issue

My Android project was working fine when I noticed that I had checked SDK version 4.2 when I meant to target Google 2.33. I set the project back to G2.33 (In the manifest it minsdk = 8 targetsdk=11) and now I have errors on two different styles.xml files in two folders named Values-v11 and values-v14.
the styles.xml in the Values-v14 folder has an error on the following line...
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
the st yles.xml in the Values-v11 folder has an error on ...
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
My other projects, that all target 2.33 don't even have these folders. What is the best way of me getting out of this mess?
Thanks, Gary
You could simply delete these folders if you don't want anything specific for SDK level 11, and the one for 14 won't be used anyway if your targetsdk is 11.
If you want to retain the one for api level 11 for custom behaviour in API level 11, you need to set the project to compile with API level 11 - i.e. if in Eclipse, select the project, go to Properties, select Android and then set the project build target to "Android 3.0" or "Google APIs" for API level 11 if you need the Google APIs.

Categories

Resources