BottomBarLayout icon indicating copy to clipboard operation
BottomBarLayout copied to clipboard

怎样和fragment关联?

Open EHENJOOM opened this issue 6 years ago • 1 comments

EHENJOOM avatar Jan 25 '19 15:01 EHENJOOM

`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文件

AnserBaby avatar Apr 26 '20 08:04 AnserBaby