user836026
user836026

Reputation: 11350

How to display a floating icon on mapview?

I would like to display an icon in mapview just like the "change to list view icon" displayed on Google Places program. any clue how to do that?

Upvotes: 2

Views: 1172

Answers (2)

MataMix
MataMix

Reputation: 3296

If you need to put an icon in a relative place of the screen you can merge the mapview with a relative layout (in the XML page) some thing like this:

<merge
xmlns:android="http://schemas.android.com/apk/res/android"
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:apiKey="xxxxxxxxxx" />

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

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/icon">
    </ImageButton>
</RelativeLayout>
</merge>

Or if you need to use an icon over a map coordinate that you specify then you need to define an overlay.

hope this helps :)

Upvotes: 3

skynet
skynet

Reputation: 9908

What you want is called an Overlay. Check out the Google Map View tutorial under Part 2.

Upvotes: 2

Related Questions