質問からわかるように、mapViewには、ユーザーがボタンをプレゼンテーションするボタンを配置する必要があります。現在の位置でmapViewを更新します。 私はボタンを上に置く方法を知っていますが、地図上に置く方法は? サンプルコードがある方、またはガイダンスのヘルプがありがとうございました...MapViewにボタンを追加するにはどうすればいいですか?
10
A
答えて
29
あなたはRelativeLayoutを使用し、ボタンをMapViewの上に置いておきます。 Googleロゴに貼らないようにしてください。ここではサンプルXMLです:オーバーレイ項目の
<?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">
<com.google.android.maps.MapView android:id="@+id/google_maps"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="@string/maps_key"/>
<Button android:id="@+id/googlemaps_select_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Select"/>
</RelativeLayout>
2
こんにちは男の検索は、何が必要です:Dここでは、Googleのリンク http://developer.android.com/resources/tutorials/views/hello-mapview.html
と良いサンプル:D
+0
私はそのコードを見る時間がありませんでしたが、私は...問題のおかげで);))) – Jovan
感謝の男..これは私が探していたものです...もう一度感謝します:DDD – Jovan
ありがとう!これは私のために役立っています! – pandre