public class

ActionBarDrawable

extends BitmapDrawable
java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ android.graphics.drawable.BitmapDrawable
       ↳ greendroid.graphics.drawable.ActionBarDrawable

Class Overview

A specialized Drawable dedicated to ActionBarItems. It automatically adapts its color depending on its current state. By default, the colors are:

  • Color.BLACK in alternative (pressed/focused)
  • Color.WHITE in otherwise

The ActionBarDrawable is a great replacement to the StateListDrawable that should be used in ActionBars.

GreenDroid offers a smart way to change the default alternative and normal colors in an application-wide manner. In order to do that, override the gdActionBarItemColorNormal and gdActionBarItemColorAlt attributes in your application theme.

Summary

Public Constructors
ActionBarDrawable(Context context, Drawable d)
Create a new ActionBarDrawable using the specified Drawable.
ActionBarDrawable(Context context, Drawable d, int normalColor, int altColor)
Create a new ActionBarDrawable using the specified Drawable.
ActionBarDrawable(Context context, int resId)
Create a new ActionBarDrawable using the specified resource identifier.
ActionBarDrawable(Context context, int resId, int normalColor, int altColor)
Create a new ActionBarDrawable using the specified resource identifier.
ActionBarDrawable(Resources res, Drawable d)
This constructor is deprecated. Use ActionBarDrawable(Context, Drawable) as it looks for the default alternative/normal colors in the theme.
ActionBarDrawable(Resources res, Drawable d, int normalColor, int altColor)
This constructor is deprecated. Use ActionBarDrawable(Context, Drawable, int, int) as it looks for the default alternative/normal colors in the theme.
ActionBarDrawable(Resources res, int resId)
This constructor is deprecated. Use ActionBarDrawable(Context, int) as it looks for the default alternative/normal colors in the theme.
ActionBarDrawable(Resources res, int resId, int normalColor, int altColor)
This constructor is deprecated. Use ActionBarDrawable(Context, int, int, int) as it looks for the default alternative/normal colors in the theme.
Public Methods
boolean isStateful()
Protected Methods
boolean onStateChange(int[] stateSet)
[Expand]
Inherited Methods
From class android.graphics.drawable.BitmapDrawable
From class android.graphics.drawable.Drawable
From class java.lang.Object

Public Constructors

public ActionBarDrawable (Context context, Drawable d)

Create a new ActionBarDrawable using the specified Drawable.

Parameters
context The Context used to retrieve resources (Bitmap/theme)
d The icon's Drawable (should be a BitmapDrawable)

public ActionBarDrawable (Context context, Drawable d, int normalColor, int altColor)

Create a new ActionBarDrawable using the specified Drawable.

Parameters
context The Context used to retrieve resources (Bitmap/theme)
d The icon's Drawable (should be a BitmapDrawable)
normalColor The color used to color the icon in normal mode
altColor The color used to color the icon in alternative mode

public ActionBarDrawable (Context context, int resId)

Create a new ActionBarDrawable using the specified resource identifier.

Parameters
context The Context used to retrieve resources (Bitmap/theme)
resId The resource identifier pointing to the icon's Bitmap

public ActionBarDrawable (Context context, int resId, int normalColor, int altColor)

Create a new ActionBarDrawable using the specified resource identifier.

Parameters
context The Context used to retrieve resources (Bitmap/theme)
resId The resource identifier pointing to the icon's Bitmap
normalColor The color used to color the icon in normal mode
altColor The color used to color the icon in alternative mode

public ActionBarDrawable (Resources res, Drawable d)

This constructor is deprecated.
Use ActionBarDrawable(Context, Drawable) as it looks for the default alternative/normal colors in the theme.

Create a new ActionBarDrawable

Parameters
res The Resources from which the given icon is retrieved
d The icon's Drawable

public ActionBarDrawable (Resources res, Drawable d, int normalColor, int altColor)

This constructor is deprecated.
Use ActionBarDrawable(Context, Drawable, int, int) as it looks for the default alternative/normal colors in the theme.

Create a new ActionBarDrawable

Parameters
res The Resources from which the given icon is retrieved
d The icon's Drawable
normalColor The color used to color the icon in normal mode
altColor The color used to color the icon in alternative mode

public ActionBarDrawable (Resources res, int resId)

This constructor is deprecated.
Use ActionBarDrawable(Context, int) as it looks for the default alternative/normal colors in the theme.

Create a new ActionBarDrawable

Parameters
res The Resources from which the given icon is retrieved
resId The icon's resource ID

public ActionBarDrawable (Resources res, int resId, int normalColor, int altColor)

This constructor is deprecated.
Use ActionBarDrawable(Context, int, int, int) as it looks for the default alternative/normal colors in the theme.

Create a new ActionBarDrawable

Parameters
res The Resources from which the given icon is retrieved
resId The icon's resource ID
normalColor The color used to color the icon in normal mode
altColor The color used to color the icon in alternative mode

Public Methods

public boolean isStateful ()

Protected Methods

protected boolean onStateChange (int[] stateSet)