employeegts
employeegts

Reputation: 144

Change only background and color of titlebar

I am trying to customize background and color of Title bar. I have seen many example on android site and stack overflow but nothing worked out for me.

In examples they are adding new elements in title bar but i want to customize existing title bar.

I do not want to change anything else. I only want to change background color and font color of text.

Upvotes: 1

Views: 8572

Answers (1)

Bobby
Bobby

Reputation: 1454

If you are using Android Lollipop (api 21+), you can edit the "styles21.xml" (in the res directory) code and add the following:

<?xml version="1.0" encoding="utf-8"?>

<resources>
    <style name="AppTheme" parent="android:Theme.Material">
        <!-- Customize your theme using Material Design here. -->
        <!-- Title Bar color here -->
        <item name="android:colorPrimary">#YOUR_COLOR_HERE</item>
        <!-- Background color here -->
        <item name="android:windowBackground">#YOUR_COLOR_HERE</item>
    </style>
</resources>

For more information see Google's "Using the Material Theme" here.

This XML code will work throughout the whole app (each different view) unless otherwise specified.

I hope this is what you are looking for!

Upvotes: 4

Related Questions