Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the shadow above the app bar?

I'd like to make the status bar transparent by adding <item name="android:statusBarColor">@android:color/transparent</item> to v21/styles.xml on style name="AppTheme.NoActionBar" but I keep getting a shadow above the app bar, is it possible to remove it?

EDIT: Ok I think the solution is to move the app bar occupying the status bar space and extending the app bar of an additional dp to match it size so my question is, is it possible to move or extend the app bar height upwards?

activity_search.xml

<android.support.design.widget.AppBarLayout
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:theme="@style/MyMaterialTheme.AppBarOverlay">

     <android.support.v7.widget.Toolbar
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="?attr/colorPrimary"
          app:popupTheme="@style/MyMaterialTheme.PopupOverlay"/>

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_search"/>

enter image description here

like image 555
brettbrdls Avatar asked Feb 29 '16 15:02

brettbrdls


2 Answers

I believe this question is pointing to same problem Android appbarlayout elevation appears in status bar

Possible solutions:

Your root layout should have android:fitsSystemWindows="true" at all times, otherwise your UI will not draw behind status bar.

Now wrap the AppBarLayout inside another CoordinatorLayout which has

android:fitsSystemWindows="false".

This will prevent the shadow from overflowing into statusbar.

like image 144
Karol Żygłowicz Avatar answered Oct 04 '22 11:10

Karol Żygłowicz


Add elevation 0dp to AppBarLayout

<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp">
like image 40
Malek Hijazi Avatar answered Oct 04 '22 13:10

Malek Hijazi