Apply Custom Theme for your activity in android.

By | February 5, 2012

In today’s tutorial I will show how to apply custom theme for your activity in android.
Android has several built in themes for applying to your activity but you can also provide your own custom themes for your activity.

Now we will start creating an activity with a custom theme applied.
Create a fresh project and name it ThemeActivity.

Now create a file named “styles.xml” in the res/values folder and copy this code into it.

<?xml version="1.0" encoding="utf-8"?>
<color name="custom_theme_color">#b0b0ff</color>
<style name="CustomTheme" parent="android:Theme.Light">
    <item name="android:windowBackground">@color/custom_theme_color</item>
    <item name="android:colorBackground">#ff00ff</item>

Now in the AndroidManifest.xml make changes in the activity tag for the activity you want to apply this theme.

Here I have only one activity which is the main activity for which I am applying the theme.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/CustomTheme">
        <activity android:name=".ThemeActivityDemo"
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />

This is the main java file.

package com.coderzheaven.pack;

import android.os.Bundle;

public class ThemeActivityDemo extends Activity {

    public void onCreate(Bundle savedInstanceState) {

I am not making any changes in the main.xml.
Now applying theme to this activity is complete and you can now run the project.

Apply theme to your activity

Apply theme to your activity

One thought on “Apply Custom Theme for your activity in android.

Leave a Reply

Your email address will not be published.