Android ActionBar Background Image

To set the background image of the relative new Actionbar in Android you can do the following:

final ActionBar actionBar = getActionBar();
BitmapDrawable background = new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.raw.actionbar_background));
actionBar.setBackgroundDrawable(background);

Note that the BitmapDrawable() is deprecated. So might might want to use BitmapDrawable(Resources) to ensure that the drawable has correctly set its target density.

Posted in Android, Tips and Tricks Tagged with: , ,