brian
brian

Reputation: 6912

How to set ActionBar background in ActionBarActivity

I import android.support.v7.app.ActionBarActivity; to use ActionBar before API 11.
I set ActionBar background as below code after API 11:

getActionBar().setBackgroundDrawable(res.getDrawable(R.drawable.top_bar_bg));

Byt I don't know how to do that before API 11.
How can I do it?

Upvotes: 0

Views: 1665

Answers (1)

Anirudh
Anirudh

Reputation: 2090

If you're using the support library you should include getSupportActionBar() instead of getActionBar(). So try-

getSupportActionBar().setBackgroundDrawable(res.getDrawable(R.drawable.top_bar_b‌​g));

Upvotes: 5

Related Questions