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?
Take a look at the colors defined in the default theme. In Android Studio, open themes. xml (app > res > values > themes > themes.
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.
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.
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"/>
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With