Настроенное информационное окно Google Map не отображает тени в Android - PullRequest
0 голосов
/ 29 октября 2018

Я использую InfoWindow для визуализации любой информации для маркера. В Android мы можем определить тень с высотой. Но тень, определенная по высоте, не отображается для InfoWindow.

Структура информационного окна выглядит следующим образом

<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/background"
        android:paddingStart="16dp"
        android:paddingEnd="16dp"
        android:paddingTop="6dp"
        android:paddingBottom="6dp"
        android:elevation="4dp"
>
    <TextView
            android:id="@+id/main_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:gravity="center_horizontal"
            android:textSize="14sp"
            android:textStyle="bold"
            tools:text="main text"
    />
    <TextView
            android:id="@+id/sub_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/main_text"
            android:layout_centerHorizontal="true"
            android:gravity="center_horizontal"
            android:textSize="11sp"
            tools:text="sub text"/>
</RelativeLayout>

Форма такая

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
    <corners android:radius="500dp"/>
    <solid android:color="@color/white"/>
</shape>

Фрагмент кода подобен этому

googleMap?.setInfoWindowAdapter(object: GoogleMap.InfoWindowAdapter {
      override fun getInfoContents(marker: Marker?): View? {
          return null
      }

      override fun getInfoWindow(marker: Marker?): View? {
          return layoutInflater.inflate(R.layout.map_info_window, null)
      }

  })
...