我正在全屏使用Google Map Android SDK中的MapView,但我需要在地图视图上显示另一个透明的全视图。覆盖图按预期显示,但是,即使覆盖图在其上,也可以控制地图(可以单击标记,可以移动地图)。
如何确保覆盖在视图中时阻止地图可控?
发布于 2020-01-20 13:50:53
在您的覆盖视图父布局上添加以下内容。
android:focusable="true"
android:focusableInTouchMode="true"
android:clickable="true"请记住,您需要将线上方放置在覆盖视图的父布局上
发布于 2020-01-20 13:44:36
您可以通过使覆盖图可单击来完成此操作。将下面的代码添加到覆盖视图的xml中。
android:clickable="true"
发布于 2020-01-20 13:46:07
例如,我使用以下代码向页面添加一个按钮
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
android:id="@+id/location_map"
class="com.google.android.gms.maps.SupportMapFragment"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#359c5e"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:padding="8dp"
android:layout_margin="5dp"
android:text="@string/go"
android:textColor="#ffffff" />
</RelativeLayout>https://stackoverflow.com/questions/59817511
复制相似问题