2

I am starting a new android app and I will use Google Maps, I am designer also and searching for inspiration I have found this screenshot: http://cdn1.appleinsider.com/Maps.071213.2.jpg
I really like the left screen and specially the blur layer in the botton of the image(the layer with info icon).

I´m reading something about how to blurred with android but all is using pictures, Bitmap, ImageView nothing with maps. So my questions is:
Can I make something similar (to the iOS screenshot) on android and how?
Thank you.

Haresh Chhelana
  • 24,720
  • 5
  • 57
  • 67
JoCuTo
  • 2,463
  • 4
  • 28
  • 44

1 Answers1

7

If anyone else is having problems with this, you gotta use the Blurry library.

But since the MapView is a surface view, it doesn't work properly with google maps, so you have to capture the MapView's image into an ImageView and then call to Blurry, like this:

mGoogleMap.snapshot(new GoogleMap.SnapshotReadyCallback() {
                @Override
                public void onSnapshotReady(Bitmap bitmap) {
                    blurView.setVisibility(View.VISIBLE);
                    blurView.setImageBitmap(bitmap);

                    Blurry.with(getContext())
                            .radius(15)
                            .sampling(2)
                            .onto(mRootLayout);

                    mAddressBarLayout.expand();

                }
            });

as you can imagine, the ImageView is placed on the MapView but it's hidden at first:

<android.support.design.widget.CoordinatorLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:animateLayoutChanges="true"
        android:orientation="vertical">

            <com.google.android.gms.maps.MapView
                android:id="@+id/map_fragment_mv"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

            <ImageView
                android:id="@+id/blur_view"
                android:visibility="visible"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

        </android.support.design.widget.CoordinatorLayout>

Hope this helps someone.

Iman Akbari
  • 2,167
  • 26
  • 31
  • Helped me, Thanks! I used the method with `.from(bitmap).into(blurView);` instead to put the blurred image on the imageview so I could make it invisible later. – George Mar 07 '18 at 23:41