Search code examples
androidcolorsruntimeandroid-actionbarstacked

How do I change the style of the Android Actionbar Stackedbar's tab at runtime?


How can I change the Android StackedActionBar's Tab text color, Tab divider color, and selected navigation Tab selector color dynamically at runtime using java? I have not been able to find solutions for this without having to alter my XML each time. I have however been able to change the StackedActionBar's background color using the method for the ActionBar class:

setStackedBackgroundDrawable(Drawable drawable)

Thanks for any help in advance.


Solution

  • If you are adding Stacked Tabs to the Actionbar pragmatically, then you can do the styling stuff via Java. If you are declaring the Actionbar's components in XML, then you cannot highly modify the styling stuff via Java.
    Here is a detailed link for dealing with Action bar.