Как установить виджет MapView с закругленными углами - PullRequest
0 голосов
/ 23 сентября 2018

Как установить виджет 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"
                app:mapType="normal" />

спасибо

Ответы [ 2 ]

0 голосов
/ 23 сентября 2018

Ссылка: Добавление закругленных углов к просмотру карты

rectangle_tained_corners.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
    <solid android:color="@android:color/transparent" />
    <stroke android:width="10dp" android:color="@color/color_gray5_eeeeee" />
    <corners android:radius="10px" />
</shape>

Использование линейного макета и поля полятот же размер ширины растягиваемого хода, как это:

<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>
0 голосов
/ 23 сентября 2018

Вы можете попробовать просмотр карты как родительский вид

<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>
...