set ActionBar Color - Android User Interface

Android examples for User Interface:ActionBar Color

Description

set ActionBar Color

Demo Code


//package com.java2s;
import android.app.Activity;

import android.graphics.drawable.ColorDrawable;

public class Main {
    public static void setActionBarColor(Activity activity, int color) {
        activity.getActionBar().setBackgroundDrawable(
                new ColorDrawable(color));
        refreshActionBar(activity);//from  w w w.  ja v a 2s. c o m
    }

    public static void refreshActionBar(Activity activity) {
        activity.getActionBar().setDisplayShowTitleEnabled(false);
        activity.getActionBar().setDisplayShowTitleEnabled(true);
    }
}

Related Tutorials