Android 如何设置圆角MapView小部件

Android 如何设置圆角MapView小部件,android,android-mapview,Android,Android Mapview,如何设置圆角MapView小部件 他的是我的地图视图 <com.google.android.gms.maps.MapView android:id="@+id/map_view" android:layout_width="match_parent" android:layout_height="260dp" app:liteMode="true"

如何设置圆角MapView小部件

他的是我的地图视图

<com.google.android.gms.maps.MapView
                android:id="@+id/map_view"
                android:layout_width="match_parent"
                android:layout_height="260dp"
                app:liteMode="true"
                app:mapType="normal" />


谢谢

您可以尝试将cardview作为查看家长

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="260dp"
    android:layout_gravity="center_horizontal|center_vertical"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="20dp"
    app:cardCornerRadius="20dp"
    app:cardElevation="0dp">

    <com.google.android.gms.maps.MapView
                android:id="@+id/map_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:liteMode="true"
                app:mapType="normal" />
</android.support.v7.widget.CardView>

您可以尝试将cardview作为视图父视图

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="260dp"
    android:layout_gravity="center_horizontal|center_vertical"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="20dp"
    app:cardCornerRadius="20dp"
    app:cardElevation="0dp">

    <com.google.android.gms.maps.MapView
                android:id="@+id/map_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:liteMode="true"
                app:mapType="normal" />
</android.support.v7.widget.CardView>

参考:

矩形\圆角\角点.xml


使用与可绘制笔划宽度大小相同的线性布局和边距,如下所示:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/rectangle_rounded_corners"
android:orientation="vertical">

<com.google.android.gms.maps.MapView
    android:id="@+id/map_details_map_view"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_marginTop="10dp"
    android:layout_marginBottom="10dp"
    android:clickable="true"
    android:enabled="true" />
</LinearLayout>

参考:

矩形\圆角\角点.xml


使用与可绘制笔划宽度大小相同的线性布局和边距,如下所示:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/rectangle_rounded_corners"
android:orientation="vertical">

<com.google.android.gms.maps.MapView
    android:id="@+id/map_details_map_view"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_marginTop="10dp"
    android:layout_marginBottom="10dp"
    android:clickable="true"
    android:enabled="true" />
</LinearLayout>


此解决方案的可能重复的可能重复无法将半径设置为仅一侧。此解决方案无法将半径设置为仅一侧。