Reputation: 457
I need to change selected tab color in my tab activity.
For example, selected item text color must be #cea939
, and unselected items colors have to be #d7ba60
. What should I do to change that? Actually, I tried to add textColor value to apptheme_tab_indicator.xml
- but no result. By the way, I use AppCompat
. And if there is a solution, how does it vary for styles
and styles-v21
?
Upvotes: 1
Views: 1387
Reputation: 11597
You can check my answer for the post How to change Viewpager tab colour dynamically?, use custom view for tabs, and chage the codes of background color setting to text color setting:
Tab selectedTab = yourActionBar.getSelectedTab();
View tabView = selectedTab.getCustomView();
TextView text = (TextView)tabView.findViewById(R.id.your_text_id);
text.setColor(your_text_color);
Hope this help!
Upvotes: 1