Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
构建布局文件时,资源ID R.ID.map会自动添加到Android项目中_Android_Android Maps V2 - Fatal编程技术网

构建布局文件时,资源ID R.ID.map会自动添加到Android项目中

构建布局文件时,资源ID R.ID.map会自动添加到Android项目中,android,android-maps-v2,Android,Android Maps V2,您好,我正在开发一个地图应用程序,在这个应用程序中,当您构建布局文件时,资源ID R.ID.map应该自动添加到Android项目中。但它会给出错误,而不是自动解决它。如何解决。谢谢 mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); 您不是动态插入FramAgent,而是使用findFragmentById查找映射片段。这意味着您需要在布局文件中包含地图片段 布局文件中可能缺少以下内

您好,我正在开发一个地图应用程序,在这个应用程序中,当您构建布局文件时,资源ID R.ID.map应该自动添加到Android项目中。但它会给出错误,而不是自动解决它。如何解决。谢谢

mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();

您不是动态插入FramAgent,而是使用findFragmentById查找映射片段。这意味着您需要在布局文件中包含地图片段

布局文件中可能缺少以下内容

<fragment
 android:id="@+id/map"
 android:name="com.google.android.gms.maps.MapFragment"
 android:layout_width="match_parent"
 android:layout_height="match_parent" />

您没有动态插入FramAgent,而是使用findFragmentById查找映射片段。这意味着您需要在布局文件中包含地图片段

布局文件中可能缺少以下内容

<fragment
 android:id="@+id/map"
 android:name="com.google.android.gms.maps.MapFragment"
 android:layout_width="match_parent"
 android:layout_height="match_parent" />