文件名称:高仿微信6.0
文件大小:122.58MB
文件格式:ZIP
更新时间:2021-06-12 17:58:31
Android学习 高仿微信6.0
Android学习,高仿微信6.0,public class ViewPagerAdapter extends FragmentPagerAdapter { /** * 聊天界面 */ private ChatFragment chatFragment; /** * 发现页面 */ private FoungFragment foundFragment; /** * 聊天界面 */ private ContactFragment contactFragment; private final String[] titles = { "聊天", "发现", "通讯录" }; public ViewPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { switch (position) { case 0: if (chatFragment == null) { chatFragment = new ChatFragment(); } return chatFragment; case 1: if (foundFragment == null) { foundFragment = new FoungFragment(); } return foundFragment; case 2: if (contactFragment == null) { contactFragment = new ContactFragment(); } return contactFragment; default: return null; } } @Override public int getCount() { return titles.length; } @Override public CharSequence getPageTitle(int position) { return titles[position]; } }