我的应用在CollapsingToolbar和我创建的侧边菜单方面存在问题。 我有一个带有CollapsingToolbar的AppBarLayout,它运行得很好。 在某一点上,我在所有人面前创建另一个视图.. 这个视图有另一个ScrollView,但是这个scrollview只能在CollapsingToolbar上方运行,像折叠一样仍然在我的视图前面。 当我尝试滚动折叠的位置时,滚动不适用于我的新视图,并且为折叠而工作,试图隐藏。
我的折叠工具栏
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:clickable="false"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:layout_collapseMode="pin"
app:tabMode="fixed"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp"
android:fitsSystemWindows="true"
app:titleEnabled="false"
>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:background="?attr/colorPrimary"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="?attr/actionBarSize"
>
....
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
新视图,只是一些包含某些组件的相对布局
Theres是一种“锁定”这个CollapsingToolbar的方法,让新视图优先进入,因为像CollapsingToolbar一样始终处于最重要的位置!
谢谢!