0

我正在開發使用Google地圖的android應用程序。我想在屏幕中心顯示十字準線,然後想要在用戶單擊按鈕時在中心繪製標記。所以我的問題是如何在地圖上畫十字線。Android Google Map V2在地圖屏幕中心繪製十字線

我搜索了這個,但所有靈魂指向舊谷歌地圖api獲得使用Overlay類(com.google.android.maps)十字線,但現在沒有這個類的支持。

請幫

我要達致這件事: -

Cross Hair

感謝

回答

0

我使用相對佈局要做到這一點了。

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

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

    <ImageView 
     android:src="@drawable/crosshair" 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:layout_centerInParent="true"/> 

</RelativeLayout>