4
我想添加覆蓋到我的谷歌地圖,這是固定在屏幕的中心,使用戶可以使用它來精細選擇一個位置。添加十字線覆蓋谷歌地圖v2
當前下面的代碼繪製了一個帶有居中十字線圖像的地圖視圖,但是當該按鈕位於地圖視圖下方時,地圖的中心會發生變化,並且十字準線不再表示已向上移動高度的地圖的中心點的按鈕。
我看Android - Showing a crosshair in the center of my Google Map但似乎它僅適合於V1 :(
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/locationpicker_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/locationpicker_add_venue"
android:clickable="true"
android:layout_weight="1"
class="com.google.android.gms.maps.SupportMapFragment"/>
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/crosshairs"
android:layout_gravity="center_vertical"
android:layout_centerInParent="true"/>
<Button
android:id="@+id/locationpicker_add_venue"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text = "Add new venue here"
android:layout_alignParentBottom="true"/>
</RelativeLayout>