我正在做一个小型的Android项目。在显示状态栏下面的工具栏时遇到了一些问题。我使用以下配置:
- 支持库版本23.2.0
- windowTranslucentStatus = true
<CollapsingToolbarLayout fitSystemWindows="true" ...>
<FrameLayout fitSystemWindows="true" ...>
<ViewPager>
....consists a fragment with framelayout and image
</ViewPager>
<Toolbar fitSystemWindows="true" ...>
</FrameLayout>
<CollapsingToolbarLayout fitSystemWindows="true"...>
.....
</AppBarLayout>
</CoordinatorLayout>`
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/fragment_musicplayer_appBarlayout_test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/fragment_musicexplorer_album_collapsingtoolbarlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="#eab22b"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="parallax"
android:fitsSystemWindows="true">
<android.support.v4.view.ViewPager
android:id="@+id/fragment_musicplayer_viewpager_test"
android:layout_width="match_parent"
android:layout_height="450dp" />
<android.support.v7.widget.Toolbar
android:id="@+id/fragment_musicplayer_toolbar_test"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@android:color/transparent"
android:fitsSystemWindows="true" />
</FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>