Skip to content Skip to sidebar Skip to footer

Implement Falling Pin Animation On Google Maps Android

I am implementing google maps in my android app. In this process I would like to add falling pin animation. I have searched every were but could not find the exact method to do thi

Solution 1:

Add marker to desired position in map then call this function with that marker

privatevoiddropPinEffect(final Marker marker) {
        finalHandlerhandler=newHandler();
        finallongstart= SystemClock.uptimeMillis();
        finallongduration=1500;

        finalInterpolatorinterpolator=newBounceInterpolator();

        handler.post(newRunnable() {
            @Overridepublicvoidrun() {
                longelapsed= SystemClock.uptimeMillis() - start;
                floatt= Math.max(
                        1 - interpolator.getInterpolation((float) elapsed
                                / duration), 0);
                marker.setAnchor(0.5f, 1.0f + 14 * t);

                if (t > 0.0) {
                    // Post again 15ms later.
                    handler.postDelayed(this, 15);
                } else {
                    marker.showInfoWindow();

                }
            }
        });
    }

Solution 2:

Check this thread and this thread

Android has overlay markers (see ItemizedOverlay) that make it easy to add images to maps, BUT note that, in my experience at least, animated images do not work when added to overlays.

But to be honest, you should remember that it's Android, and copying every little feature from iOS is unnecessary. Google Maps on Android doesn't use a pin marker, it uses a static blue spot - I'd say it's best to replicate that and remember your users are Android users, not iOS users - they want consistency across Android apps

Solution 3:

Post a Comment for "Implement Falling Pin Animation On Google Maps Android"