Aditya Prasun
Aditya Prasun

Reputation: 49

How to hide the shadow of toolbar in android?

I have created a toolbar in my Android App. Now what I want is to hide the shadow that is being shown as in the picture below enter image description here

and here is my code for it app_bar_home.xml

<?xml version="1.0" encoding="utf-8"?><android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="zitat.entwicklers.org.HomeActivity">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

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

<include layout="@layout/content_home" />

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    android:src="@drawable/ic_menu_share" /></android.support.design.widget.CoordinatorLayout>

Upvotes: 1

Views: 567

Answers (2)

Bubunyo Nyavor
Bubunyo Nyavor

Reputation: 2570

Add if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) getSupportActionBar().setElevation(0); after setContentView() in your activity

Upvotes: 1

Vipul Asri
Vipul Asri

Reputation: 9233

just add app:elevation="0dp" in AppBarLayout.

Upvotes: 3

Related Questions