由于以下错误,无法添加到片段事务中,您该如何解决?
add() in FragmentTransaction cannot be applied to:
Expected Parameters: Actual Arguments:
int R.id.mapWithOverlay
android.support.v4.app.Fragment _mapFragment (com.google.android.gms.maps.MapFragment)
String "map"
以下是代码:
代码如下:
android.support.v4.app.FragmentTransaction fragTx = getSupportFragmentManager().beginTransaction();
if (fragTx != null) {
_mapFragment = MapFragment.newInstance(mapOptions);
fragTx.add(R.id.mapWithOverlay, _mapFragment, "map");
fragTx.commit();
} else {
Toast.makeText(this, "Could not display the map", Toast.LENGTH_SHORT).show();
}
提前感谢您。