Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show pop up on clicking map overlay?

I want to show a custom image with some data in it while clicking map overlay that i have added to google map in android.

Can any one guide me how can i create that custom image or thing to be displayed on google map with some data on it?

some body told me to go for custom view but i have no idea about them.

like image 929
UMAR-MOBITSOLUTIONS Avatar asked Mar 04 '10 13:03

UMAR-MOBITSOLUTIONS


People also ask

How do I add pop up to Openlayers?

Click on the map to get a popup. The popup is composed of a few basic elements: a container, a close button, and a place for the content. To anchor the popup to the map, an ol/Overlay is created with the popup container.

What is a pop up map?

Pop-ups contain information about features and images in map layers, such as hiking trails, land cover types, or unemployment rates. Pop-ups can include attachments, images, charts, and text, and they can link to external web pages.


2 Answers

This project demonstrates adding popup panels (ones that persist, unlike a Toast) over top of a map.

like image 127
CommonsWare Avatar answered Nov 03 '22 13:11

CommonsWare


To create a custom toast message that shows an image and some text use this java code.

LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast_layout, (ViewGroup) findViewById(R.id.toast_layout_root));

TextView text = (TextView) layout.findViewById(R.id.text);

text.setText(content);
ImageView image = (ImageView) layout.findViewById(R.id.image);
image.setImageBitmap(bmImg);


Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout);
toast.show();

and this layout file

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/toast_layout_root"
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:padding="10dp"
          android:background="#DAAA"
          >
<ImageView android:id="@+id/image"
           android:layout_width="40dp"
           android:layout_height="40dp"
           android:layout_marginRight="10dp"
           />
<TextView android:id="@+id/text"
          android:layout_width="wrap_content"
          android:layout_height="fill_parent"
          android:textColor="#FFF"
          />
</LinearLayout>
like image 40
Janusz Avatar answered Nov 03 '22 12:11

Janusz