EDIT của 2016/01/02: Bug nên được giải quyết bằng cách áp dụng mã được cung cấp bởi Android Đội bóng: https://stackoverflow.com/a/35132144/3397345CoordinatorLayout thanh trạng thái đệm biến mất khỏi ViewPager trang 2
EDIT của 27/01/2016: Lỗi vẫn chưa được giải quyết trong v23.1.1. Các giải pháp được cung cấp cho đến bây giờ không cung cấp thanh trạng thái trong suốt (đó là mục đích của bố cục này) hoặc quá phức tạp. Một màn hình-kỷ lục mới của lỗi này có sẵn ở đây: https://www.youtube.com/watch?v=76IxhlUx8MQ
EDIT của 23/07/2015: Hỗ trợ thiết kế Thư viện v22.2.1 không khắc phục được :-(Ngoài ra điều này xảy ra trên thanh công cụ trở lại nhanh chóng trên MainActivity
EDIT của 28/07/2015: Linked câu hỏi:. CoordinatorLayout status bar padding disappears during fragment transactions
từ kho dụ https://github.com/chrisbanes/cheesesquare tôi đã thực hiện các ViewPager trên hoạt động chi tiết Nó hoạt động, nhưng Statusbar biến mất khỏi trang thứ 2 như bạn thấy trong các hình ảnh chỉ trong các thiết bị Lollipop, Ý tưởng nào? tôi sử dụng android:fitsSystemWindows="true"
nhưng nó chỉ hoạt động trên trang đầu tiên :-(
activity_detail_viewpager.xml nếu tôi đặt ở đây fitsSystemWindows, Statusbar là không minh bạch nữa, nhưng nó hoạt động (thanh trạng thái đệm là không bị mất). Nhưng tôi muốn nó trong suốt!
<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/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="ifContentScrolls"/>
</android.support.design.widget.CoordinatorLayout>
activity_detail_fragment.xml
<CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
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="@dimen/detail_backdrop_height"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
<ImageView
android:id="@+id/back_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="24dp">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/card_margin">
...
</android.support.v7.widget.CardView>
...
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:clickable="true"
android:src="@drawable/ic_discuss"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom|end"
app:borderWidth="0dp"/>
</android.support.design.widget.CoordinatorLayout>
style.xml v21
<resources>
<style name="AppTheme" parent="AppTheme.Base">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</resources>
văn vấn đề đến Google: https://code.google.com/p/android/issues/detail?id=180492 - Issue được xác nhận cũng bởi những người khác ppl – Davidea