package com.example.a1112.adapter;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.example.a1112.fragment.FragmentOne;
import com.example.a1112.fragment.FragmentThree;
import com.example.a1112.fragment.FragmentTwo;
public class MainAdapter extends FragmentPagerAdapter {
private String[] menus = new String[]{“首页”, “视频”, “我的”};
public MainAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int i) {
switch (i) {
case 0:
return new FragmentOne();
case 1:
return new FragmentTwo();
case 2:
return new FragmentThree();
default:
return new Fragment();
}
}
@Override
public int getCount() {
return menus.length;
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return menus[position];
}
}