【发布时间】:2016-04-22 08:32:42
【问题描述】:
我正在尝试使用 API v2 在 android 中显示地图。
我想在地图上显示 Google 素材图标“我的位置”。但是,每当我尝试添加布局时,它都不会反映在输出中。
我可以得到没有图标的地图。我需要图标来与地图集成。
当我在片段标签之外编写 ImageButton 代码时,图标显示在预览窗格中,但不在其中。
我应该把 ImageButton 代码放在哪里?
Mylayout.xml 的代码:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
</fragment>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ic_gps"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:src="@drawable/ic_my_location_black_18dp" />
</RelativeLayout>
【问题讨论】:
-
您是指默认的“查找我的位置”按钮吗?
标签: android android-studio material-design google-maps-android-api-2