java.lang.IllegalStateException: Can't change tag of fragment fendo1MainActivity{531dbce4 id=0x7f0b0054 android:switcher:2131427412:0}: was android:switcher:2131427412:0 now android:switcher:2131427412:1
这里写错了:
//往碎片集合添加碎片 fendo1MainActivity fendo1=new fendo1MainActivity(); fendo2MainActivity fendo2=new fendo2MainActivity(); fendo3MainActivity fendo3=new fendo3MainActivity(); list.add(fendo1); list.add(fendo1); list.add(fendo1); //给ViewPager设置适配器 viewpager.setAdapter(new myAdapter(getSupportFragmentManager()));
因该是:
list.add(fendo1); list.add(fendo2); list.add(fendo3);