Changing the Theme
  • 19 Dec 2023
  • 1 Minute to read
  • Contributors
  • Dark
    Light

Changing the Theme

  • Dark
    Light

Article summary

Some developers may prefer to remove appcompat from the project, which requires they change the theme.

  • If you remove the dependency on the appcompat library, you’ll need to change styles.xml to base your AppTheme on another parent theme.

Change:

Theme.AppCompat.Light.DarkActionBar to either @android:style/Theme.Material.Light.DarkActionBar 
or 
@android:style/Theme.Holo.Light.DarkActionBar

The Holo theme can preferable to Material on the device because button focus states are more apparent with Holo. If you do use Material, we recommend defining a custom button style that clearly changes the look of buttons when they have focus.

  • If you changed your app theme to Material, in styles.xml you need to prepend the android namespace in front of the color attributes:

<item name="android:colorPrimary">
	@color/colorPrimary 
</item> 
<item name="android:colorPrimaryDark">
	@color/colorPrimaryDark
</item> 
<item name="android:colorAccent">
	@color/colorAccent
</item>

  • If you changed your app theme to Holo, in styles.xml you should remove the three <item> sub elements under <style> that refer to colors as these items are not used. In addition, you can delete colors.xml if you choose.

  • Under the mipmap resource directories, you can delete ic_launcher_round.png as round icons are not used on the device. If you choose to delete the round icon, you should remove the roundIcon attribute that got generated in AndroidManifest.xml on the <application> tag.


Was this article helpful?