我想实现可折叠的工具栏。我已经使用协调器布局来实现相同的功能。我在布局中有一个视图寻呼机,在整个屏幕上都可以看到一个线性布局。当导航按钮可见时,视图很好。但是当我隐藏导航按钮时,即我将主题更改为全屏显示时,底部的线性布局被向下推到屏幕外部。这是该视图的xml编码
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:expanded="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:scrimAnimationDuration="300"
app:titleEnabled="false">
<ImageView
android:id="@+id/image_view_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
tools:src="@drawable/drawable1" />
<include
layout="@layout/custom_view"
android:fitsSystemWindows="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="4dp"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/master_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:fitsSystemWindows="true"
app:layout_behavior="@string/scroll_behaviour">
<LinearLayout
android:id="@+id/container1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/container2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#CCFFFFFF"
android:orientation="horizontal">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="bottom"
android:layout_toStartOf="@+id/extra_icons_container"
android:layout_toLeftOf="@+id/extra_icons_container"
android:background="#CCFFFFFF"
app:layout_collapseMode="pin"
app:tabIndicatorColor="@color/colorPrimaryDesignV4"
app:tabIndicatorHeight="2dp"
app:tabMinWidth="50dp"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/colorPrimaryDesignV4"
app:tabTextAppearance="@style/TabBarTextStyle"
app:tabTextColor="@color/color_v4_secondary" />
<LinearLayout
android:id="@+id/extra_icons_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true">
<RelativeLayout
android:id="@+id/container3"
android:layout_width="36dp"
android:layout_height="40dp"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:visibility="gone"
tools:visibility="visible">
<ProgressBar
android:id="@+id/progress_bar1"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:visibility="gone"
tools:visibility="visible" />
<ImageView
android:id="@+id/image_view_2"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:src="@drawable/drawable2"
android:visibility="gone"
tools:visibility="visible" />
</RelativeLayout>
<ImageView
android:id="@+id/image_view_3"
android:layout_width="40dp"
android:layout_height="40dp"
android:scaleType="centerCrop"
android:src="@drawable/drawable3"
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout>
</RelativeLayout>
<View
android:id="@+id/divider_two"
style="@style/HorizontalDividerV4" />
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:layout_dodgeInsetEdges="bottom" />
</LinearLayout>
<LinearLayout
android:id="@+id/container4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="24dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<ProgressBar
android:layout_width="24dp"
android:layout_height="24dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/container5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible" />
</FrameLayout>
<LinearLayout
android:id="@+id/container6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:fitsSystemWindows="true"
android:gravity="bottom"
android:minHeight="48dp"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible" />
<LinearLayout
android:id="@+id/container7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone" />
</android.support.design.widget.CoordinatorLayout>
以下是图像: