I am developing a really light-weight application which does not actually need a dedicated theme, so I removed android:theme attribute of the <application> tag in AndroidManifest.xml. That seems to work except that the application got dark theme. Is there a way to switch to the light one?
To clarify, I would like the application to have default theme that depends on the platform the application is running on, i.e. it is "Holo" for 4, "Material" for 5, and etc. And it is working now that way, but the theme variant is always dark, whilst I need the light one. I set the "minimum API" property to 14, but I am thinking about 11 as well.
Related
I'm trying to change the theme of an app that I'm trying to develop using Android Studio. Apparently, there are at least two ways to do so: by editing the styles.xml file and by using the button above the preview (for me it's the middle button stating the name of the selected theme).
What I'm witnessing is this: When I try to change the theme by using the button, it will update the preview. When I edit the styles.xml file, neither the button caption nor the preview change. And when I run the application, neither the theme chosen using the button nor the theme specified in the styles.xml file are used.
So for example, I have chosen "Material Dark" using the button and specified Holo Light in styles.xml like so without the two interfering with each other at all:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
And then, when I finally run the app in an emulator, I don't even know the theme (light gray action bar, black text color) that it displays the app in but it's not one that I have specified.
That being said, (almost) every other change I apply to the app in any way using Android Studio is displayed just fine both in the preview and in the emulator. An exception to that rule is the changing of the text color of the elements through the activity's XML file...
I'd appreciate any help, since I'm at my wit's end and also somewhat new to the whole thing.
Thanks! - koala
This is because ide sees no emulator. Emulator always run, but ide could hang up in state "Waiting for target device to come online".
Possible reason - Android API versions mismatch. Check if minSdkVersion and targetSdkVersion in Gradle Scripts - build.gradle (Module: app) correspond device API (also Synch push Synch Project with Gradle Files on a panel). Also low versions (e.g. API 15) result in ide-emulator link failure, inspite of application and device versions match.
I've taken the basic Hello World app from the SDK examples and have been learning Android by modifying it. Currently I'm trying to change the Theme. I'm testing it on my Nexus 7 running the latest OS and I'm using Eclipse.
In my manifest I have
android:theme="#style/AppBaseTheme"
In values-v11/styles I have
style name="AppBaseTheme" parent="android:Theme.Black
I've tried using Holo and am aware I need to be V11 or higher to do that.
When I try running my app it starts on the tablet and I can see the black background as expected, but before it can draw any components Eclipse goes to debug mode in ActivityThread.performLaunchActivity and then into ZygoteInit$MethodAndArgsCaller.run() before my app dies.
If I use this it's fine:
style name="AppBaseTheme" parent="#style/Theme.AppCompat.Light"
I feel I'm missing something obvious or there's a fundamental part of Themes that I don't understand. I have tried removing the .android/ directory and restarting Eclipse, that fixed a few other issues.
I know the # symbol in this context denotes that it is an inbuilt style by android. Does that mean I have to add something to my app to link in other themes? If so what exactly?
I'm trying to style my application with custom styles. However, I am facing a problem when on install of application the styles aren't applied, then if I change something (anything) in the styles and compile it again (reinstall not uninstall followed by install) it applies all the styles. But as you understand this isn't an intended experience for users.
What could cause such a strange behavior?
UDATE:
The api is from 13 to 17.
I'm getting this:
Instead of this:
As you can see the styles aren't applied to this dialog. This also happens to other activities.
When using the designer for Mono for Android in Visual Studio,
the controls have a nice clean design but as soon as you run the app on a device (emulator or real)the controls have a completely different style:
Is this because the designer uses a specific theme, if so which one,
or is there something else I have to do to get the same style on the device as in the designer?
You probably have the default theme set to Theme.Holo.Light in the designer. In the upper-right of the designer, you will see a button that allows you to select the theme. See the screenshot below.
If you need to change the theme to Holo light or just Holo, reference this post. You will need to make some themes resources and update your application manifest.
This normally happens when your Target Framework is set to Automatic - it will drop down the lowest theme it can use, you will want to change that to API 14/15 to pick up the "Halo" theme from within Android
I am developing my new Android App and after I made the first layouts, I was wondering why everything is white (background) and not black like always before. So I figured out it is because of Theme.Holo.Light.DarkActionBar. I immediately changed it to Theme.Holo but nothing changed in the Emulator.
I googled the problem and they said that your minSDK has to be 11+, so I changed it to 11,12,13,14 but nothing changed again!
What can I do to see the old and nice black theme?
The values-v11 and values-v14 folders have styles.xml files in them that need to be updated in addition to the main one.
Use Theme.Holo. Since you elected not to post any source code, it is impossible to indicate where you are going wrong. However, if you run an app using a theme based upon Theme.Holo -- such as this sample app -- you get a dark background.
The easiest way to get Theme.Holo is to not specify a theme at all, as Theme.Holo is the default for apps with android:targetSdkVersion of 11 or higher and running on an API Level 11+ device.
The sample app I linked to takes a more elaborate approach, courtesy of Eclipse's code generators:
It has res/values/styles.xml defining AppTheme as inheriting from the old dark Theme:
It has res/values/styles.xml defining AppTheme as inheriting from Theme.Holo:
It uses AppTheme in its manifest (which for some reason is not displaying in this answer, so you will have to settle for clicking the link)
Hence, it will use Theme.Holo on API Level 11+ devices and Theme on older devices. Both supply a dark background.