Android 地图设计更改

Android maps design change

是否可以对 android Fragment 进行设计调整,使地图看起来像这样?

您可以使用 MapBox 而不是 Google 地图。然后你就可以自定义你的地图了。

完全有可能。我认为你需要的都可以在布局 XML 中完成(你可以在你自己的 Fragment 的子类中使用),如下所示:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

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

        <Space
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/some_9patch_drawable_with_white_sides"/>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="30dp"
            android:text="Search text here"
            android:ems="10"
            android:id="@+id/editText" />

    </FrameLayout>

    <TextView
        android:text="Your actions down here"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView" />

</LinearLayout>

我认为最难的部分是创建一个带有白色边的 9 块可绘制对象来模拟我认为您的地图的样子,但完全有可能。

因此,您需要添加如下内容:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


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


    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitXY"
        android:src="@drawable/map_white_overlay" />

</RelativeLayout>

其中@drawable/map_white_overlay 将是您的白色渐变图像。请设计师从他的 psd 中获取它,或者尝试以某种方式自己获取它。

至于地图样式,从 google-play-service 9.6.0 开始,您可以使用此 link

设置地图样式