Reputation: 154
i don't know why, but seems that when the toolbar collapse, appears a second status bar.
I used android:fitsSystemWindows="true"
in all components, because without this the toolbar came out from the status bar.
Here are some images to better explain:
Images
I have never seen such a thing, and I tried them all but I do not know how to solve it.
I could not find anything on the net.
Here 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>
Activity onCreate:
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>
Upvotes: 5
Views: 1922
Reputation: 17813
Whoever faces this issue, add this to parent elements:
android:fitsSystemWindows="true"
In above code I think it will be :
<android.support.design.widget.AppBarLayout
android:fitsSystemWindows="true"
...
>
...
</android.support.design.widget.AppBarLayout>
Good luck,'.
Upvotes: 0
Reputation: 2504
It seems an extra-padding added by CollapsingToolbarLayout on its fitSystemWindows().
I think you have to enable <item name="android:windowTranslucentStatus">true</item>
too at theme level (API19+), to get a stable layout as it was in fullscreen mode.
Upvotes: 1