在 google 中标记的信息 window 中添加微调器 Android 中的地图

Adding Spinner in info window of marker in google Maps in Android

我想在我的标记的自定义信息 Window 中添加一个微调器,所有的事情都完成了,微调器显示在那里,但是当我点击那个微调器时,没有反应!!!!。

所以可以做些什么才能单击微调器并select其中的一项。

我的信息布局 Window 是

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/custom_info_bubble"
    android:orientation="horizontal">



    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:ellipsize="end"
            android:singleLine="true"
            android:textColor="#000000"
            android:textSize="14dp"
            android:textStyle="bold"
            />
        <Spinner
            android:id="@+id/spinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:singleLine="true"
            android:textColor="#000000"
            android:textSize="14dp" />
    </LinearLayout>
    <ImageButton
        android:id="@+id/imButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="5dp"
        android:background="#00000000"
        android:adjustViewBounds="true"></ImageButton>
</LinearLayout>

来自 Google 文档:

Note: The info window that is drawn is not a live view. The view is rendered as an image (using View.draw(Canvas)) at the time it is returned. This means that any subsequent changes to the view will not be reflected by the info window on the map. To update the info window later (for example, after an image has loaded), call showInfoWindow(). Furthermore, the info window will not respect any of the interactivity typical for a normal view such as touch or gesture events. However you can listen to a generic click event on the whole info window as described in the section below.

然后,您将无法处理微调器点击,但只能在点击信息窗口时处理。