Не найден BR в GoogleMap.InfoWindowAdapter - PullRequest
0 голосов
/ 20 февраля 2020

android studio

использовать привязку данных

в build.gradle:

android {
  dataBinding {
        enabled = true
    }
}

apply plugin: 'kotlin-kapt'

мой макет xml: map_marker_info_content_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<layout 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">

    <data>

        <variable
            name="model"
            type="com.myproject.client.client.api.model.GazStation" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

вот действие, которое его использует:

import com.myproject.client.databinding.MapMarkerInfoContentLayoutBinding

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

            override fun getInfoContents(marker: Marker): View? {
                val markerLatLng = marker.position
                val selectGazStation =
                    gazStationsList.first { it.latitude == markerLatLng.latitude && it.longitude == markerLatLng.longitude }
                val binding =
                    MapMarkerInfoContentLayoutBinding.inflate(layoutInflater, parent);
                binding.setVariable(BR.model, selectGazStation)
                return binding.root
            }
        })

Но я получаю ошибку компиляции:

Unresolved reference: BR
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...