Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/190.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 折叠/扩展Google地图片段_Android_Google Maps - Fatal编程技术网

Android 折叠/扩展Google地图片段

Android 折叠/扩展Google地图片段,android,google-maps,Android,Google Maps,我有一个布局,上面是谷歌地图片段,下面是滚动视图。我需要在滚动底部视图时折叠片段,就像这个例子(滚动技术4): 这是我的布局。如何实现这一点 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" and

我有一个布局,上面是谷歌地图片段,下面是滚动视图。我需要在滚动底部视图时折叠片段,就像这个例子(滚动技术4):

这是我的布局。如何实现这一点

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/my_appbar_container"
        android:layout_width="match_parent"
        android:layout_height="192dp"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:background="@color/colorPrimary">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        android:background="@color/colorPrimary"
        app:title="Address"
        app:expandedTitleMarginStart="48dp"
        app:expandedTitleMarginEnd="64dp">

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="200dp">

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/abc_popup_background_mtrl_mult">

                <fragment
                    android:id="@+id/autocomplete_fragment"
                    android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />

            </FrameLayout>

    </fragment>

    </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>


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

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="@dimen/activity_horizontal_margin">

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

                <TextView
                    android:id="@+id/name_label"
                    android:layout_width="@dimen/textview_with"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:text="@string/textview_name"
                    android:textColor="#000"
                    android:textSize="@dimen/textview_size" />

                <EditText
                    android:id="@+id/name"
                    android:hint="@string/edittext_hint_name"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_toEndOf="@+id/name_label"
                    android:layout_toRightOf="@+id/name_label"
                    android:singleLine="true" />


            </RelativeLayout>

            ...

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

            ...

            </RelativeLayout>
        </LinearLayout>
    </ScrollView>

</LinearLayout>

...
...

用MapsView代替片段解决了这个问题:

在协调布局中很容易实现