package com.example.zhoukao1; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.PagerAdapter; import java.util.ArrayList; import java.util.List; /** * Created by dell on 2017/8/4. */ class MyAdapter extends FragmentPagerAdapter { private String[] titles = {"推荐", "热点", "北京", "视屏", "社会", "娱乐"}; private List<Fragment> mFragments = new ArrayList<Fragment>(); private FragmentManager mFragmentManager; public MyAdapter(FragmentManager fm) { super(fm); mFragmentManager = fm; } public MyAdapter(FragmentManager fm, List<Fragment> tempFragments) { super(fm); mFragmentManager = fm; mFragments = tempFragments; } @Override public Fragment getItem(int position) { MyFragemt myFragemt = new MyFragemt(); return myFragemt; } @Override public int getCount() { return titles.length; } @Override public CharSequence getPageTitle(int position) { return titles[position]; } }
MyAdapter(周考1)
最新推荐文章于 2021-05-27 08:47:16 发布