gammaraptor
gammaraptor

Reputation: 1886

Changing Tab Text in SlidingTabLayout

I am currently using SlidingTabLayout as found here:

https://developer.android.com/samples/SlidingTabsBasic/src/com.example.android.common/view/SlidingTabLayout.html

The issue I have is that I need to have the existing tab titles change after they have been populated with populateTabStrip() since I need the app to have multi-language support. The current method that works is to restart the application, but I would rather not do that.

Upvotes: 0

Views: 435

Answers (1)

gammaraptor
gammaraptor

Reputation: 1886

Well, I managed to get it working after looking at the code more closely. Adding this function seemed to do the trick for me.

public void updateText(CharSequence[] Titles) {
    for (int i = 0; i < mTabStrip.getChildCount(); i++) {
        TextView text = (TextView)mTabStrip.getChildAt(i);
        text.setText(Titles[i]);

    }
}

Upvotes: 2

Related Questions