Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

themes

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?

like image 832
user2815899 Avatar asked Oct 04 '13 16:10

user2815899


People also ask

How do I change my default app theme?

Take a look at the colors defined in the default theme. In Android Studio, open themes. xml (app > res > values > themes > themes.

How do I make my own app theme?

Creating new themesOpen the Theme dropdown menu near the top of the right side of the Theme Editor. Click Create New Theme. In the New Theme dialog, enter a name for the new theme. In the Parent theme name list, click on the parent from which the theme inherits initial resources.

How do I change the default theme in Android Studio?

To change default themes go to File and click on Settings. A new Settings dialog will appear, like this. Under the Appearance & Behaviour -> Appearance, you will find Theme. Choose the right theme from the drop-down and click on Apply and then Ok.


3 Answers

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"/>
like image 31
live-love Avatar answered Oct 11 '22 07:10

live-love


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.

like image 65
Valerij Bielskij Avatar answered Oct 11 '22 08:10

Valerij Bielskij


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

like image 1
tabjsina Avatar answered Oct 11 '22 09:10

tabjsina