FragmenManager replace makes overlay

前端 未结 3 1474
无人共我
无人共我 2021-01-06 09:59

I\'m using supportlib v4 to reach master-detail flow.

Problem: New instance of \"details\" fragment overlays the first one (xml created) instead replace it.<

3条回答
  •  悲哀的现实
    2021-01-06 10:28

    Check following code it will work.

    View fragmentContainer = ClassName.this.findViewById(R.id.fragmentTrack);
     TrackInfoFragment fragment = new TrackInfoFragment();                  
    getSupportFragmentManager().beginTransaction()
    .replace(fragmentContainer.getId(), fragment).commit();     
    

提交回复
热议问题