I have added ActionBar tabs to my application. Default color for that underline is light blue. How do I change that color or style for selected tab ?
For anyone wants to change actionbar color/background in code, you can do something like this
final ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.action_bar_bg));
To change the tab bar color under the actionbar:
actionBar.setStackedBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.color_brown_dark)));
To change tab bar background:
actionBar.setStackedBackgroundDrawable(getResources().getDrawable(
R.drawable.coupon_header));
This may give some clues Action Bar Style Gen
selectableItemBackground
is the attribute I think your looking for.
I'd recommend you read this article about Customizing the Action Bar as well as look at this question on SO and this one as well.
In code i cant seem to find a way to customize the individual item selected but , customizing the bar itself would look something like this.
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable("FF0000"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With