Open EHENJOOM opened 5 years ago
`private void changeFragment(int currentPosition) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
switch (currentPosition) { case 0: //tabImageView1.setColorFilter(color); if (homeFragment == null) { homeFragment = new HomeFragment(); } transaction.replace(R.id.fl_content, homeFragment); break; case 1: //tabImageView2.setColorFilter(color); if (videoFragment == null) { videoFragment = new VideoFragment(); } transaction.replace(R.id.fl_content, videoFragment); break; case 2: //tabImageView3.setColorFilter(color); if (aboutFragment == null) { aboutFragment = new AboutFragment(); } transaction.replace(R.id.fl_content, aboutFragment); break; default: break; } //transaction.replace(R.id.fl_content, mFragmentList.get(currentPosition)); transaction.commit(); }`
这个方法里改成这样,要新建homeFragment,videoFragment,aboutFragment,这三个XML文件
`private void changeFragment(int currentPosition) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
这个方法里改成这样,要新建homeFragment,videoFragment,aboutFragment,这三个XML文件