我在这里学习Android版的谷歌地图教程:https://developers.google.com/maps/documentation/android-sdk/current-place-tutorial
我的问题是,一旦我进入"添加映射"部分,那是我的片段的java代码吗?还是第一部分的主要java?
谢谢。
the doc clearly says that
"
Add a <fragment> element to your activity's layout file, activity_maps.xml. "
so the the "activity_maps.xml" is the activity layout file and the following code should be inside the "activity_maps.xml"
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.currentplacedetailsonmap.MapsActivityCurrentPlace" />
如果你觉得这个链接对有帮助,请参阅它
https://stackoverflow.com/questions/20314635/android-map-in-fragment