How to change Android Titlebar theme color from Purple

When you create your first ever application or select a new project in Android Studio you must have seen that the default color theme of the Titlebar (Toolbar) is purple. If you want to change the color theme, follow the below steps,

  1. Go to res folder,
  2. Now go to values -> colors.xml
  3. Now add the new colors that you want, example,
    <color name="grey">#888888
  4. Now go to themes folder,
  5. Open themes.xml file
  6. Change the colorPrimary value to @color/grey
    <resources xmlns:tools="">
        <style name="Theme.MyApplication" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
            <item name="colorPrimary">@color/grey</item>
            <item name="colorPrimaryVariant">@color/purple_700</item>
            <item name="colorOnPrimary">@color/white</item>
            <item name="colorSecondary">@color/teal_200</item>
            <item name="colorSecondaryVariant">@color/teal_700</item>
            <item name="colorOnSecondary">@color/black</item>
            <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
  7. Launch the app in emulator to see the changes.
Change Android App Titlebar color from purple
Change Android App Titlebar color from purple

Note: You can change the other theme colors here such as statusBarColor, colorSecondary, colorSecondaryVariant and so on in the same way!

Happy Coding!!

Have Questions? Post them here!
Try Out Code2care Dev Tools:


Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR -