B
B
Bartar2016-08-12 21:20:30
Android
Bartar, 2016-08-12 21:20:30

How to localize tab titles in TavLayout?

I don’t know how to localize the names of the tabs, I searched on the Internet, but there are only simple examples without localization and, in general, if there is any standard for the tab adapter.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Bartar, 2016-08-13
@Bartar

@Override
    public CharSequence getPageTitle(int position) {
        switch (position){
            case 0: return getString(R.string.tab_item_Room);
            case 1: return getString(R.string.tab_item_Friend);
            case 2: return getString(R.string.tab_item_Message);
            default: return null;
        }
    }

R
Rou1997, 2016-08-12
@Rou1997

It is for TabLayout - no, everything is standard for Android.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question