百度地图api - Android百度地图SDK,MapView上层按钮可见却不可触,怎么解决?
PHPz
PHPz 2017-04-17 17:41:36
0
3
530

Android 布局中,我在百度地图的地图层上层(顶层)添加一个按钮。但是添加后,按钮可以被看见,却触摸不到——触摸后还是由按钮下面的地图层在响应,似乎有一层透明的“地图触摸层”盖住了按钮。

我尝试了两种布局,效果都如上所述。其中的TextureMapView换作MapView也无济于事:

<RelativeLayout>
    <android.support.design.widget.FloatingActionButton/>
    <com.baidu.mapapi.map.TextureMapView/>
</RelativeLayout>
<RelativeLayout>
    <com.baidu.mapapi.map.TextureMapView/>
    <android.support.design.widget.FloatingActionButton/>
</RelativeLayout>

不光是这个按钮,我另一个BottomSheet视觉上盖住百度地图的时候,触觉上仍然是地图在顶层。

请问有什么解决办法?谢谢。

UPD:

我发现如果把同一个位置的 FAB 改成普通 button 的话,button 就可以被正常点击。这就让我更疑惑了。所以补充上我的 xml 片段:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1">
    <com.baidu.mapapi.map.TextureMapView
        android:id="@+id/bmapView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clickable="true"/>
    <android.support.design.widget.FloatingActionButton
        android:id="@+id/get_current_location"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_gps_fixed_black_24dp"
        android:layout_margin="@dimen/fab_margin"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"/>
</RelativeLayout>
PHPz
PHPz

学习是最好的投资!

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!