case 4:
if (framentTest222 == null) {
framentTest222 = new FramentTest222();
getSupportFragmentManager().beginTransaction().add(R.id.fragment, framentTest222).commit();
} else {
getSupportFragmentManager().beginTransaction().show(framentTest222).commit();
}
break;
case 5:
if (fragmentPatroll == null) {
fragmentPatroll = new FragmentPatroll1();
getSupportFragmentManager().beginTransaction().add(R.id.fragment, fragmentPatroll).commit();
} else {
getSupportFragmentManager().beginTransaction().show(fragmentPatroll).commit();
}
break;
case 6:
fragment 切换用hide show 方式
后面遇到两个天地图fragment切换时后一个fragment的地图被前一个fragment的地图重叠覆盖了,百度了很多办法解决不了,最后fragmen里代码里加了这个就解决了
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (hidden) {
SurfaceView childAt = (SurfaceView) mMapView.getChildAt(0);
childAt.setVisibility(View.GONE);
LogTagUtils.logGisInfo("=====onHiddenChanged=FragmentPatroll1不见了");
stopLocation();
} else {
SurfaceView childAt = (SurfaceView) mMapView.getChildAt(0);
childAt.setVisibility(View.VISIBLE);
startLocation();
LogTagUtils.logGisInfo("=====onHiddenChanged=FragmentPatroll1见到");
}
}
参考链接:https://blog.youkuaiyun.com/u013068887/article/details/56844862