2010-11-18 6 views
0

Ich muss zusätzliche Bildschaltfläche "mein aktueller Standort" in einer oberen rechten Ecke des MapView platzieren. Irgendwelche Ideen wie man das macht?Android MapView - Anfügen zusätzlicher Steuerelemente an ein MapView in der gewünschten Position

Generieren der Fragen generisch:
1) Laut MapView-Dokumentation ist es möglich, zusätzliche Ansichtsobjekte an ein MapView anzuhängen. Wie macht man das?
2) Wie platzieren Sie solche zusätzlichen Steuerelemente in einer bestimmten Position auf MapView?

Antwort

2

Das Beispiel fügt unter einer Taste auf einem mapview, kopieren Sie sie einfach einfügen und dann auf die Schaltfläche bewegen, wo es Ihnen gefällt:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/map_main" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 


<com.google.android.maps.MapView 
    android:id="@+id/mapview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:clickable="true" 
    android:apiKey="0y6Hyjz6Kxo-NOV_9KHYF7-ECYeGt99xeyVU3IQ"/> 

<Button 
    android:id="@+id/select_3" 
    android:layout_centerHorizontal="true" 
    android:layout_marginTop="13dp" 
    android:text="Center on Pickup Location" 
    style="@style/BasicButton" 
    android:layout_height = "40dp" 
    android:layout_width = "280dp" 
    android:onClick="selfSelectCenterLocation"> 
</Button> 


</RelativeLayout>