Hi!

The easiest way to put buttons on your map is to use a RelativeLayout.
Put the MapView into it and after that you can put there other layout
objects too.
In the RelativeLayout the view you put after the map view can be over
it, so you can draw anything over the map this way, and you don't need
to worry about the draw() part.

Here is a simple layout xml I used to put a left and right arrow and a
textView over the map.

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

<RelativeLayout android:id="@+id/MainLayout" xmlns:android="http://
schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:id="@+id/MapLayout"
    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="--apikey--"
    />


</LinearLayout>

<LinearLayout android:id="@+id/ButtonLayout"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_marginTop="5px">
<Button android:id="@+id/MapPrevButton"
android:layout_width="wrap_content" android:drawableLeft="@drawable/
ic_menu_back" android:layout_height="wrap_content"></Button>

<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/
MapDetailsButton" android:layout_weight="1.0" android:text="b"></
Button><Button android:id="@+id/MapNextButton"
android:layout_width="wrap_content" android:drawableRight="@drawable/
ic_menu_forward" android:layout_height="wrap_content"></Button>

</LinearLayout>
</RelativeLayout>

After this you can hide and show the MapLayout view as you wish, and
bind event handlers to it as usual (and also design it in eclipse as
you normally would).

Bye,
    Zsolt

On Aug 27, 4:28 pm, Tony Wong <manifa...@gmail.com> wrote:
> In Google Maps, when you complete a search and go to map mode
> browsing, you see two types of overlay objects. One of the overlays
> contain a title, description, and left and right buttons. The buttons
> have different states (normal, disabled, pressed down) so the overlay
> must be more complex than the default provided one. Can anyone point
> me to the right direction on how to implement this type of
> functionality? The only point of entry I can see from searching for
> examples is draw() in ItemizedOverlay, but is that an area where I can
> add buttons? Perhaps they are using something separate from the
> MapView classes altogether, can anyone enlighten me?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to