@ Override
Public void onClick (View View) {
FragmentManager FM=getFragmentManager ();
FragmentTransaction ft=FM. BeginTransaction ();
Fragments of f=null;
The switch (the getId ()) {
Case R.i which imer:
F=new Timer_Fragment ();
break;
Case R.i d.r emind:
F=new Remind_Fragment ();
break;
Case R.i d.p LAN:
F=new Plan_Fragment ();
break;
Case R.i d.r ecord:
F=new Record_Fragment ();
break;
}
Ft. Replace (R.i d.f ragment, f);
Ft.com MIT ();
}
};
Under similar QQ switch button, but I'm from the default of the first switch to the second, the first default will not disappear, several other all can't, don't know why!
This is the default fragment shows
When I choose other fragments of the default or don't disappear!!!!! 1
For bosses to help solve! Got a long time, don't know where is wrong,
CodePudding user response:
Before switching to not display the fragments of the hiddenTransaction. Hide (fragments);
CodePudding user response:
Suggest that you first before making the switch to hold all the fragments are all the hidden, then fragments according to need