我有解决方案,而不是使用onViewCreated()方法代替onActivityCreated()方法,而是使用了构建版本目标API 23,谢谢。
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
insertNestedFragment();
}
// Embeds the child fragment dynamically
private void insertNestedFragment() {
FragmentManager fm = getChildFragmentManager();
mSupportMapFragment = (SupportMapFragment) fm.findFragmentById(R.id.child_fragment_container);
if (mSupportMapFragment == null) {
mSupportMapFragment = SupportMapFragment.newInstance();
fm.beginTransaction().replace(R.id.child_fragment_container, mSupportMapFragment).commit();
}
}