Search code examples
androidactionbarsherlock

Add a view below actionbarsherlock


I am using actionbarsherlock in my app. I want to add a view below the actionbar. See the following screenshot: enter image description here

I want to add the 4-colored strip to the actionbar. How to do this?


Solution

  • You can do that by creating a CustomView for your ActionBar.

    Then you just got to do this:

    getSupportActionBar().setDisplayShowCustomEnabled(true);
    getSupportActionBar().setCustomView(R.layout.my_custom_view);
    

    See more in here

    Edit: Actually, you can do it using:

    getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background_action_bar));
    

    Your drawable is something like this:

    action bar background