How to take the shadow off a Toolbar?

Asked

Viewed 749 times

-2

I made Toolbar transparent but I’d like to remove that shadow that highlights him.

Grateful to those who help ^^

  • 1

    Post the code of your Toolbar, without code it gets a little difficult to guide you to do something.

2 answers

0


If you are using a similar structure to implement your Toolbar:

<android.support.design.widget.AppBarLayout
   android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ...>

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        .../>

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

The shadow that is appearing is not from Toolbar, and yes of the AppBarLayout. To solve this, in your AppBarLayout put the properties android:elevation="0dp" and app:elevation="0dp" the code would look like this:

<android.support.design.widget.AppBarLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:elevation="0dp"
   app:elevation="0dp"
    ...>

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        .../>

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

-1

Two things may have happened: 1- You are not creating your theme from one that is Noactionbar so by default it will appear as Actionbar regardless of having color or not the shadow will appear. The first step will be to check if Parent to your theme is Theme.AppCompat.Noactionbar or etc. 2- If everything is all right in 1, at the moment Voce sets your Toolbar attributes as text etc do not call the Setsupportactionbar(Toolbar)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.