Janki
Janki

Reputation: 61

Remove AppBarLayout Below Shadow

I'm not able to remove AppBarLayout below shadow i used below code

app:elevation="0dp"

in both AppBarLayout and Toolbar but it's not working for me. Can anyone help me to solve this problem. enter image description here

Upvotes: 1

Views: 4049

Answers (2)

Varma460
Varma460

Reputation: 507

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.

or 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">

Upvotes: 2

SaravInfern
SaravInfern

Reputation: 3388

You should set elevation as 0 for toolbar

<android.support.design.widget.AppBarLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:fitsSystemWindows="true"
    app:elevation="0dp">

    <android.support.v7.widget.Toolbar
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        app:elevation="0dp"  />

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

Upvotes: 1

Related Questions