ogaclejapan / SmartTabLayout

A custom ViewPager title strip which gives continuous feedback to the user when scrolling
Apache License 2.0
7.09k stars 1.34k forks source link

change color of the tab text programmatically in Java code #75

Closed Fakher-Hakim closed 8 years ago

ogaclejapan commented 9 years ago

Hi, @Fakher-Hakim

Please use this method.

View tabView = tabLayout.getTabAt(position);

Solved?

Fakher-Hakim commented 9 years ago

Ok i get the position of the tab but i can't find any method to change the text color ! i just get these 2 methods: setTextAlignment() setTextDirection()

ogaclejapan commented 9 years ago

HI, @Fakher-Hakim

If you are using the default tab you need to transform yourself.

TextView tabView = (TextView) tabLayout.getTabAt(position);

If you specify a custom tab layout, please use the findViewById.


<com.ogaclejapan.smarttablayout.SmartTabLayout
    ....
    app:stl_customTabTextLayoutId="@layout/custom_tab"
    app:stl_customTabTextViewId="@id/custom_text"
    ....
    />
TextView tabView = (TextView) tabLayout.getTabAt(position).findViewById(R.id.custom_text);
ogaclejapan commented 8 years ago

For a long time, there is no response. So, we will close the issue.