Android 折叠/扩展Google地图片段
我有一个布局,上面是谷歌地图片段,下面是滚动视图。我需要在滚动底部视图时折叠片段,就像这个例子(滚动技术4): 这是我的布局。如何实现这一点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
<?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代替片段解决了这个问题:
在协调布局中很容易实现