Android - макет границы, старая «граница» все еще видна - PullRequest
0 голосов
/ 03 марта 2019

У меня есть макет ограничения, где я добавил границу, например, так:

custom_info_window.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/info_window_boarder"
    >
...
...

info_window_boarder.xml

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#FFFFFF"/>
    <stroke android:width="3dip" android:color="#B1BCBE" />
    <corners android:radius="10dip"/>
    <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

но я все еще вижу старую "границу" (границу белого квадрата).Как мне избавиться от этого?

enter image description here

1 Ответ

0 голосов
/ 04 марта 2019

Разобрался.

Я настраивал информационное окно в getInfoContents вместо getInfoWindow.

getInfoContents даст вам белый ящик по умолчанию.Если вы хотите пользовательский, как я, вам нужно будет сделать все в getInfoWindow примерно так:

     mMap.setInfoWindowAdapter(object : GoogleMap.InfoWindowAdapter {
        override fun getInfoWindow(marker: Marker?): View {
            val row: View = layoutInflater.inflate(R.layout.custom_info_window, null)
            val tvAddress: TextView = row.findViewById(R.id.textView_iw_address)
            val tvTime: TextView = row.findViewById(R.id.textView_iw_time)

            tvAddress.text = marker?.title
            tvTime.text = marker?.snippet

            return row            }

        override fun getInfoContents(marker: Marker?): View? {
            //put in here, if you just want the default info window
            return null
        }
    })
...