I donโt know why, but it seems that when the toolbar crashes, a second status bar appears.
I used android:fitsSystemWindows="true" in all components because without this the toolbar came out of the status bar.
Here are some images to better explain: Images
I have never seen this, and I tried them all, but I do not know how to solve it. I did not find anything on the net.
Here is the code:
Layout:
<android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" app:statusBarScrim="?attr/colorPrimaryDark" app:contentScrim="?attr/colorPrimary" app:layout_scrollFlags="scroll|exitUntilCollapsed" > <ImageView android:id="@+id/photo_actor" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:fitsSystemWindows="true" app:layout_collapseMode="parallax" /> <View android:layout_width="match_parent" android:layout_height="match_parent" app:layout_collapseMode="parallax" android:fitsSystemWindows="true" android:background="@drawable/background_protection" /> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:fitsSystemWindows="true" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" 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:padding="8dp" android:orientation="vertical"> <WebView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@null" android:id="@+id/webview_bio"/> </LinearLayout> </android.support.v4.widget.NestedScrollView>
OnCreate action:
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); setSupportActionBar(toolbar); CollapsingToolbarLayout collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); if(collapsingToolbarLayout!=null){ collapsingToolbarLayout.setTitle(advm.getName()); }
Styles: (the one I use in the current Activity is the second)
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:textColor">@color/text_color</item> </style> <style name="AppTheme.NoActionBar"> <item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:windowTranslucentNavigation">true</item> <item name="android:statusBarColor">@android:color/transparent</item> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style>
source share