带有模糊层的谷歌地图

JoC*_*uTo 2 android google-maps

我正在启动一个新的 android 应用程序,我将使用谷歌地图,我也是设计师,正在寻找灵感我找到了这个截图:http : //cdn1.appleinsider.com/Maps.071213.2.jpg
我真的很喜欢左边的屏幕和特别是图像底部的模糊层(带有信息图标的层)。

我正在阅读有关如何使用 android 进行模糊处理的内容,但所有内容都在使用图片、位图、ImageView,而没有使用地图。所以我的问题是:
我可以在 android 上制作类似的东西(类似于 iOS 屏幕截图)吗?
谢谢你。

Ima*_*ari 6

如果其他人对此有疑问,则必须使用Blurry 库

但是由于 MapView 是一个表面视图,它不能与谷歌地图正常工作,因此您必须将其MapView图像捕获到一个ImageView然后调用 Blurry,如下所示:

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();

                }
            });
Run Code Online (Sandbox Code Playgroud)

可以想象,ImageView 被放置在 MapView 上,但它最初是隐藏的:

<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>
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助某人。