I have created the action bar by
ActionBar actionbar = getActionBar()
The background of the action bar is changed by
actionbar.setBackgroundDrawable(actionBarBackgroundImage);
Now I need to change the action bar tabs underline color programmatically. Is there any method to change the action bar tabs underline color?
Alternatively you could use Android Action Bar Style Generator to easily theme your action bar and tabs.
Here is a much easier way. I know you were looking for a programmatic change, but this one is REALLY easy.
I've been struggling with this for days, but finally found the solution. I'm using AppCompat. You can set colorAccent
in your theme and that will change the highlight color on your ActionBar. Like so:
<item name="colorAccent">@color/highlightcolor</item>
Here it is in context:
<style name="LightTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/darkgrey</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="colorAccent">@color/highlightcolor</item>
</style>
Where I originally posted this answer: Android Tab underline color not changing
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