Using theme generated by Holo Style Generator - android

I managed to get this done a few days back but now I've forgotten what steps I took to make it work.
I've generated a custom widget theme from http://android-holo-colors.com
I've copied it to my res folder. I need to know what to change in the manifest and the styles.xml file to make it work with my app. I've tried a lot of different things but the theme either doesn't change or generates and xml error.

manifest.xml
<activity
android:name="com.yourapp.app"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:theme="#style/Theme.YourTheme"
...
</activity>
res/values/styles.xml
<style name="YourTheme" parent="android:Theme.Light">
...
</style>

Related

How to change app default theme to a different app theme?

I have an Android app that has a default theme of Holo.Light but I want to change it to Theme.Black.I tried to do this by changing the style tag in the manifest android:theme="#style/AppTheme" to Theme.Black but it cannot be found.Is there extra steps I have to take in changing the theme?
Actually you should define your styles in res/values/styles.xml. I guess now you've got the following configuration:
<style name="AppBaseTheme" parent="android:Theme.Holo.Light"/>
<style name="AppTheme" parent="AppBaseTheme"/>
so if you want to use Theme.Black then change AppBaseTheme parent to android:Theme.Black or you could change app style directly in manifest file like this - android:theme="#android:style/Theme.Black". You must be lacking android namespace before style tag.
You can read more about styles and themes here.
To change your application to a different built-in theme, just add this line under application tag in your app's manifest.xml file.
Example:
<application
android:theme="#android:style/Theme.Holo"/>
<application
android:theme="#android:style/Theme.Holo.Light"/>
<application
android:theme="#android:style/Theme.Black"/>
<application
android:theme="#android:style/Theme.DeviceDefault"/>
If you set style to DeviceDefault it will require min SDK version 14, but if you won't add a style, it will set to the device default anyway.
<uses-sdk
android:minSdkVersion="14"/>
If you are trying to reference an android style, you need to put "android:" in there
android:theme="#android:style/Theme.Black"
If that doesn't solve it, you may need to edit your question with the full manifest file, so we can see more details
Or try to check your mainActivity.xml you make sure that this one
xmlns:app="http://schemas.android.com/apk/res-auto"hereis included

How to set the holo dark theme in a Android app?

How can I set the dark holo theme in my app?
At this time I got this:
<style name="AppTheme" parent="android:Theme.Holo.Light" />
But when I change it to:
<style name="AppTheme" parent="android:Theme.Holo.Dark" />
I get an error error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Dark'.
How to solve the problem?
change parent="android:Theme.Holo.Dark"
to parent="android:Theme.Holo"
The holo dark theme is called Holo
By default android will set Holo to the Dark theme. There is no theme called Holo.Dark, there's only Holo.Light, that's why you are getting the resource not found error.
So just set it to:
<style name="AppTheme" parent="android:Theme.Holo" />
According the android.com, you only need to set it in the AndroidManifest.xml file:
http://developer.android.com/guide/topics/ui/themes.html#ApplyATheme
Adding the theme attribute to your application element worked for me:
--AndroidManifest.xml--
...
<application ...
android:theme="#android:style/Theme.Holo"/>
...
</application>
In your application android manifest file, under the application tag you can try several of these themes.
Replace
<application
android:theme="#style/AppTheme" >
with different themes defined by the android system. They can be like:-
android:theme="#android:style/Theme.Black"
android:theme="#android:style/Theme.DeviceDefault"
android:theme="#android:style/Theme.DeviceDefault.Dialog"
android:theme="#android:style/Theme.Holo"
android:theme="#android:style/Theme.Translucent"
Each of these themes will have a different effect on your application like the DeviceDefault.Dialog will make your application look like a dialog box. You should try more of these. You can have a look from the android sdk or simply use auto complete in Eclipse IDE to explore the various available options.
A correct way to define your own theme would be to edit the styles.xml file present in the resources folder of your application.

Android Tablet Application - ActionBar

We are trying to build an Android App for Samsung Galaxy Tablets. Is there a way we can increase the height of the ActionBar? We are using Android 3.1 API 12.
You can apply a custom theme to your application.
Create styles.xml in your res/values/ directory and add something like this:
<style name="CustomTheme" parent="android:style/Theme">
<item name="android:actionBarSize">#dimen/action_bar_default_height</item>
</style>
Then create dimens.xml in your res/values/ directory and add something like this:
<resources>
<dimen name="action_bar_default_height">55dp</dimen>
</resources>
Then in your application manifest set the theme of the application like this:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:logo="#drawable/ic_launcher"
android:theme="#style/CustomTheme" >
...
</application>
You will need to create a custom Action Bar.
Here is a good tutorial
Creating a custom Action bar
Also here is a good example from the dev site.
Android Action Bar

How to set a universal background for an application

I am trying to set a background for every XML layout in my application, and I am using the same picture for them all. At the moment, I am going through all hundred or so layouts and just typing in the code:
android:background="#drawable/dirtwall"
Into all of the layouts. How would I be able to set it automatically so I wouldn't have to change other backgrounds as I made more, and so I wouldn't have to go through all of my XML files?
Also, I am using Eclipse.
You can use styles. This way, you can define all common elements in a single place and then update it only there.
Example style.xml, which should be located in your project's /res/values/ folder
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="appearance">
<item name="android:background">#drawable/dirtwall</item>
</style>
</resources>
and use it like
<LinearLayout
...
style = "#style/appearance"
>
Apply a theme to an Activity or application
To set a theme for all the activities of your application, open the AndroidManifest.xml file and edit the <application> tag to include the android:theme attribute with the style name. For example:
<application android:theme="#style/CustomTheme">
If you want a theme applied to just one Activity in your application, then add the android:theme attribute to the <activity> tag instead.
if you want the background to be transparent, use the Translucent theme:
<activity android:theme="#android:style/Theme.Translucent">
here is the declaration for a custom theme which is simply the standard platforms default light theme. It would go in an XML file under
res/values (typically res/values/styles.xml):
<style name="CustomTheme" parent="android:Theme.Light">
...
</style>

Android - Remove top banner in new application?

Is there a way to remove the banner that appears at the top of my new Android application that has the application name in it? I think I need to do something in the AndroidManifest.xml file, but I'm not sure what to do.
This is actually in the Common Tasks and How to Do Them under the section "Configuring General Window Properties."
[update] as per the comments
Either call...
requestWindowFeature(Window.FEATURE_NO_TITLE);
Or add the following to your Android manifest file...
<application android:icon="#drawable/icon"
android:theme="#android:style/Theme.NoTitleBar">
In file Style.xml:
(App--->src--->main--->res->values--->styles.xml) changes the < resources> to :
<resources>
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
</style>
</resources>

Categories

Resources