0
我正在開發一個需要處理mapview的android應用程序。我基本上需要做的就是在屏幕的中心放置一個PIN,這個PIN將通過相對佈局在mapview上。用戶可以根據他的意願移動地圖。在移動地圖並定位PIN碼後,我需要從該位置獲得協調(lat和lng)。Android MapView座標x屏幕位置
它基本上類似於用戶可以請求出租車的應用程序。 UberCab
第三段說:固定栓下的地圖和[使用]的「舉個例子,如在公司的博客中解釋說,當你訂購一輛汽車,你可以通過移動設置拾取地點」整個地圖準確設置您的位置Android應用程序上的信息面板具有清晰的透明度,可讓您專注於地圖以及您前往的位置。「
我的佈局將是這個樣子:
<RelativeLayout android:id="@+id/mapviewContainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/tvCurrentAddress">
<ImageView android:id="@+id/pin_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/pin_red"
android:layout_centerInParent="true" />
<com.google.android.maps.MapView android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="@string/mapKey" />
</RelativeLayout>
我想實現同樣的事情。有誰知道如何做到這一點?
感謝您的關注
牛逼
在這種情況下,pin不會是overlayitem,它將是佈局定義的一個元素,它將成爲屏幕中集中的ImageView。 – Thiago
@Thiago:編輯:沒關係。我現在得到你想要做的。 – DeeV
@Thiago:如果是這種情況,那麼由於引腳位於屏幕的中心,所以當用戶選擇位置時,似乎可以在MapView上調用getMapCenter()。根據文檔,它返回地圖中心的GeoPoint。 – DeeV