Pankaj Bansal
Pankaj Bansal

Reputation: 387

How I can remove shadow or divider from bottom of AppBar layout or Toolbar?

enter image description here

I wants to remove shadow or divider from bottom of AppBar layout or Toolbar

Here is my xml code

elevation, actionBarDivider already tried.

<com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:elevation="0dp"
            android:theme="@style/AppTheme.AppBarOverlay">

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/colorPrimaryDark"
                app:popupTheme="@style/AppTheme.PopupOverlay" />

 </com.google.android.material.appbar.AppBarLayout>

Upvotes: 1

Views: 2087

Answers (2)

In my case app:elevation="0dp" also hiding the Toolbar layout, so I've used android:outlineProvider="none" in AppBarLayout and it works fine.

<com.google.android.material.appbar.AppBarLayout
    android:id="@+id/appBarLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:outlineProvider="none"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
    
    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_scrollFlags="scroll|enterAlways">

        <!-- Your Layout -->
    
    </androidx.appcompat.widget.Toolbar>
    
</com.google.android.material.appbar.AppBarLayout>

Upvotes: 0

Sk Suraj
Sk Suraj

Reputation: 546

Set elevation 0(Zero) dp (ex: android:elevation="0dp" or app:elevation="0dp"), like below:

<com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:elevation="0dp"
            android:theme="@style/AppTheme.AppBarOverlay">

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/colorPrimaryDark"
                app:popupTheme="@style/AppTheme.PopupOverlay"
                 />

 </com.google.android.material.appbar.AppBarLayout>

Upvotes: 7

Related Questions