add();报错了
Cannot resolve method 'add(int, com.example.sky.myapplication.Fragment2)
这是错误提示,
case R.id.button2:{
Fragment2 fragment2=new Fragment2();
FragmentManager fragmentManager=getSupportFragmentManager();
FragmentTransaction beginTransaction=fragmentManager.beginTransaction();
beginTransaction.add(R.id.Lin22,fragment2);
break;
}
这是我的代码 beginTransaction.add(R.id.Lin22,fragment2); 括号内报错