android - Toolbar is clipped underneath the system bar -


as found on internet use translucent system bar, coordinatorlayoutwith appbarlayoutand toolbar. scrolling nestedscrollviewmoves toolbar top, underneath systembar, pixels left behind. looks quite ugly:

scrolled left on pixels

so here comes details:

  • compilesdkversion 23
  • buildtoolsversion "23.0.3"
  • minsdkversion 21
  • targetsdkversion 23
  • 'com.android.support:appcompat-v7:23.4.0'
  • 'com.android.support:design:23.4.0'

styles:

    <style name="apptheme" parent="theme.appcompat.light.darkactionbar">         <item name="colorprimary">@android:color/transparent</item>         <item name="colorprimarydark">@android:color/transparent</item>         <item name="coloraccent">#22ddaa</item>         <item name="colorcontrolnormal">#ffffff</item>          <item name="windowactionbar">false</item>         <item name="windownotitle">true</item>         <item name="android:windowdrawssystembarbackgrounds">true</item>          <item name="android:statusbarcolor">@android:color/transparent</item>         <item name="android:windowactionbaroverlay">true</item>         <item name="android:windowtranslucentstatus">true</item>         <!--<item name="android:windowtranslucentnavigation">true</item>-->         <!--<item name="android:fitssystemwindows">false</item>-->     </style> 

layout:

    <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"                     xmlns:app="http://schemas.android.com/apk/res-auto"                     android:layout_width="match_parent"                     android:layout_height="match_parent">          <imageview             android:layout_width="match_parent"             android:layout_height="match_parent"             android:scaletype="centercrop"             android:src="@drawable/gradient"/>          <android.support.design.widget.coordinatorlayout             android:id="@+id/activity_password_forgot_coordinator"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:fitssystemwindows="true">              <android.support.design.widget.appbarlayout                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:background="@android:color/transparent"                 android:theme="@style/apptheme.appbaroverlay"                 app:elevation="0dp">                  <android.support.v7.widget.toolbar                     android:id="@+id/toolbar"                     android:layout_width="match_parent"                     android:layout_height="?attr/actionbarsize"                     android:background="@android:color/transparent"                     app:layout_scrollflags="scroll|enteralways"                     app:popuptheme="@style/apptheme.popupoverlay"                     app:titletextappearance="@style/actionbar_title"/>             </android.support.design.widget.appbarlayout>              <android.support.v4.widget.nestedscrollview                 android:layout_width="match_parent"                 android:layout_height="match_parent"                 android:cliptopadding="false"                 app:layout_behavior="@string/appbar_scrolling_view_behavior">                  <linearlayout                     android:layout_width="match_parent"                     android:layout_height="match_parent"                     android:orientation="vertical">                      <textview                         style="@style/text_white_strong"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:text="lorem ipsum dolor..."/>                  </linearlayout>             </android.support.v4.widget.nestedscrollview>         </android.support.design.widget.coordinatorlayout>     </relativelayout> 

by way: need use relativelayout / imageview combination large image in background should visible under system bar. question using gradient...


ok, patched layout this:

    <android.support.design.widget.coordinatorlayout>          <relativelayout>             <imageview/>         </relativelayout>          <android.support.design.widget.appbarlayout>             <android.support.v7.widget.toolbar/>         </android.support.design.widget.appbarlayout>          <android.support.v4.widget.nestedscrollview>             <linearlayout>                 <textview/>             </linearlayout>         </android.support.v4.widget.nestedscrollview>     </android.support.design.widget.coordinatorlayout> 

now looks this:

toolbar high

then tried android:fitssystemwindows="true" in lots of variations, cannot toolbar below systembar (without systembar getting grey...)


Comments

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -