Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><em>I am posting the core concept that is working to have the drop pin animation in mapView as that of iPhopne.</em> <strong>Same can be integrated with overlays also....</strong> </p> <pre><code>Drawable drawableImage = this.getResources().getDrawable(R.drawable.marker); myCustomOverlay = new CustomOverlay(drawableImage, mapView); initGeoPoint = new GeoPoint((int) (latitudeArray[i] * 1E6),(int) (longitudeArray[i] * 1E6)); OverlayItem overlayItem = new OverlayItem(initGeoPoint,getLocationAddress(latitudeArray[i], longitudeArray[i]),"xyz"); myCustomOverlay.addOverlay(overlayItem); mapOverlays.add(myCustomOverlay); RelativeLayout v = (RelativeLayout) View.inflate(getApplicationContext(),R.layout.marker_layout, null); ImageView markerView = (ImageView) v.findViewById(R.id.marker_img_view); AnimationSet animation = new AnimationSet(true); TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, -400.0f, 0.0f); translateAnimation.setDuration(1000); animation.addAnimation(translateAnimation); markerView.startAnimation(animation); mapView.addView(v, new MapView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.FILL_PARENT), new GeoPoint((int) (latitude * 1E6),(int) (longitude * 1E6)), MapView.LayoutParams.BOTTOM_CENTER)); mapView.invalidate(); </code></pre> <p>marker_layout is as folows:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;ImageView android:id="@+id/marker_img_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:src="@drawable/marker" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Overlay Class ###########</p> <pre><code>public class CustomOverlay extends BalloonItemizedOverlay&lt;OverlayItem&gt; { private ArrayList&lt;OverlayItem&gt; m_overlays = new ArrayList&lt;OverlayItem&gt;(); private Context c; public CustomOverlay(Drawable defaultMarker, MapView mapView) { super(boundCenter(defaultMarker), mapView); c = mapView.getContext(); } public void addOverlay(OverlayItem overlay) { m_overlays.add(overlay); populate(); } @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { if (!shadow) { super.draw(canvas, mapView, false); } } public void removeOverlay(OverlayItem overlay) { m_overlays.remove(overlay); populate(); } @Override protected OverlayItem createItem(int i) { return m_overlays.get(i); } @Override public int size() { return m_overlays.size(); } @Override protected boolean onBalloonTap(int index, OverlayItem item) { Toast.makeText( c, "onBalloonTap for overlay index " + index + " Item" + item.getTitle(), Toast.LENGTH_LONG).show(); String id = ""; return true; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload