0

Each Fragment displaying its own title/name

How to title/name each fragment so that their respective names appear on the PagerTitleStrip?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Haxor
  • 2,306
  • 4
  • 16
  • 18

1 Answers1

2

You need to override getPageTitle in your PagerAdapter class and set the title according to the position of the fragments.

@Override
        public CharSequence getPageTitle (int position) 
        {

            switch(position)
            {
            case 0 : return "Movies";
            case 1 : return "Music";
            case 2 : return "Games!";
            }
            return "Easy";  //this wont be executed
        }
Haxor
  • 2,306
  • 4
  • 16
  • 18