'How to remove the border around the toolbar?
In my app I am using a toolbar and it seems there are borders around it that I'd like to get rid of :

and I created it like that :
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:minHeight="?attr/actionBarSize"/>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
and I use it like that :
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
layout="@layout/app_bar_main_light"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
And I never found an attribute or styling specifying what is this border.
Solution 1:[1]
I tried it by without AppBarLayout, and it's working. Don't use AppBarLayout, just use Toolbar as it is.
Solution 2:[2]
If @joyl answer works but still you do not wish to remove your AppBarLayout then set elevation to 0 in AppBarLayout like follows:
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp">
Solution 3:[3]
This is my solution.
android:stateListAnimator="@null"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | joyl |
| Solution 2 | Faisal Shaikh |
| Solution 3 | Năng Lê |
