如何从Google的InfoWindow发送点击侦听器到SlidingUpPanelLayout中的第二个视图

时间:2019-05-30 11:52:38

标签: android google-maps

我在SlidingUpPanelLayout中将google map作为主视图,将textview作为第二视图。我要实现的是当用户单击图钉的InfoWindow时使textview可见。从一开始,textview设置为不可见。到目前为止,我有这样的布局:

<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoPanelHeight="68dp"
sothree:umanoShadowHeight="4dp">

<My Google map xml markup>

<TextView
    android:id="@+id/sliding_textview"
    android:layout_width="match_parent"
    android:visibility="invisible"
    android:clickable="true"
    android:layout_height="match_parent"
    android:gravity="center|top"
    android:text="The Awesome Sliding Up Panel"
    android:textSize="16sp"
    android:focusable="true" />


</com.sothree.slidinguppanel.SlidingUpPanelLayout>

和用于处理点击的Java代码:

gMap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
                @Override
                public void onInfoWindowClick(Marker marker) {
                    tvSlidingTextView.setVisibility(View.VISIBLE);
                }
            });

但是不会显示textview。我该如何实现?任何建议将不胜感激。

0 个答案:

没有答案