Kyryl Zotov
Kyryl Zotov

Reputation: 1978

AppBarLayout and Toolbar set no shadow

I have AppBarLayout and Toolbar in acitivty and TabLayout into my Fragment. How can I set my toolbar shadow to zero so it would be smooth place between toolbar and tablayout?

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:elevation="0dp"
    android:theme="@style/SDK.Theme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:minHeight="?attr/actionBarSize"
        app:elevation="0dp"
        local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

Upvotes: 1

Views: 1741

Answers (2)

OhhhThatVarun
OhhhThatVarun

Reputation: 4330

This also works if you wanna try.

appBarLayout.isEnabled = false

Upvotes: 0

Michał
Michał

Reputation: 108

You can remove the shadow programatically.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {            
    appBar.setElevation(0);
}

Where appBar is your AppBarLayout.

EDIT:

I've just noticed you use android:elevation="0dp" attribute. Use app:elevation="0dp" if you want to do it via xml.

Upvotes: 1

Related Questions