相关疑难解决方法(0)

如何在Scroll View中正确滚动Google地图?

我有一个片段,其中包含一个位于我的布局滚动视图内的地图(视图).

问题是地图无法向上或向下滚动(难以滚动).滚动视图似乎干扰了地图的垂直滚动.它水平滚动(平滑)而不是垂直滚动.

我怎样才能解决这个问题?

我的XML布局:

<ScrollView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_below="@+id/toolbar">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/imageViewContactEmail"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:layout_marginStart="20dp"
                android:layout_marginTop="250dp"
                android:contentDescription="@string/contactEmailIcon"
                android:src="@drawable/ic_action_contactemail" />

            <TextView
                android:id="@+id/textViewContactEmail"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignEnd="@+id/imageViewContactEmail"
                android:layout_alignRight="@+id/imageViewContactEmail"
                android:layout_marginEnd="-50dp"
                android:layout_marginRight="-50dp"
                android:layout_marginTop="255dp"
                android:text="@string/contactEmail"
                android:textColor="#bdbdbd" />

            <TextView
                android:id="@+id/textViewContactEmailLink"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="61dp"
                android:layout_marginStart="61dp"
                android:layout_marginTop="275dp"
                android:text="@string/emailNDTC"
                android:textColor="#2196F3" />

            <ImageView
                android:id="@+id/imageViewContactLine"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/textViewContactEmailLink"
                android:layout_marginTop="20dp"
                android:contentDescription="@string/contactLine"
                android:src="@drawable/line" />

            <ImageView
                android:id="@+id/imageViewContactPhone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/imageViewContactLine"
                android:layout_marginLeft="20dp"
                android:layout_marginStart="20dp"
                android:layout_marginTop="20dp"
                android:contentDescription="@string/contactPhoneIcon"
                android:src="@drawable/ic_action_contactphone" />

            <TextView
                android:id="@+id/textViewContactPhone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignEnd="@+id/imageViewContactEmail"
                android:layout_alignRight="@+id/imageViewContactEmail"
                android:layout_below="@+id/imageViewContactLine"
                android:layout_marginEnd="-50dp"
                android:layout_marginRight="-50dp"
                android:layout_marginTop="22dp"
                android:text="@string/contactPhone"
                android:textColor="#bdbdbd" />

            <TextView
                android:id="@+id/textViewContactPhoneLink"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android google-maps scrollview android-scrollview

2
推荐指数
1
解决办法
4443
查看次数