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

前端 未结 4 1319
长情又很酷
长情又很酷 2020-12-03 10:32

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 androi

相关标签:
4条回答
  • 2020-12-03 11:05

    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"/>
    
    0 讨论(0)
  • 2020-12-03 11:07

    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.

    0 讨论(0)
  • 2020-12-03 11:13

    Or try to check your mainActivity.xml you make sure that this one
    xmlns:app="http://schemas.android.com/apk/res-auto"hereis included

    0 讨论(0)
  • 2020-12-03 11:22

    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

    0 讨论(0)
提交回复
热议问题