Change tabs text color in TabLayout to different colors programmatically

后端 未结 5 849
刺人心
刺人心 2021-01-18 14:02

I have 7 dates tabs in my screen, when tab selected, the text is black in color; while other select-able tabs are white in color. If the date falls on another month, I want

5条回答
  •  我在风中等你
    2021-01-18 14:33

    set tab text color this way :

    tabLayout.setTabTextColors(ContextCompat.getColorStateList(this, R.color.tab_selector));
    tabLayout.setSelectedTabIndicatorColor(ContextCompat.getColor(this, R.color.indicator));
    

提交回复
热议问题