我希望当底部工作表展开时向上推动工具栏,并在底部工作表展开时拉回工具栏。我看到的所有示例都是其他视图,它们合并到工具栏中,或者捕捉到工具栏顶部,但没有一个隐藏工具栏。如何做到这一点?如何在展开时将底部工作表推出工具栏,并在折叠时将其拉回?
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
>
<FrameLayout
android:id="@+id/mainContentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/red"
/>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
>
<FrameLayout
android:id="@+id/topContentContainer"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/blue"
app:layout_scrollFlags="scroll|enterAlways|snap"
/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/categoriesSelectionContainer"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@color/green"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="android.support.design.widget.AppBarLayout.ScrollingViewBehavior"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
/>
</android.support.v4.widget.NestedScrollView>
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
你可以使用折叠工具栏为此目的 –
@NileshRathod你可以更具体一点或指向我的例子吗? – Nima