0

I want to remove the shadow between toolbar and tablayout, but keep the shadow under tablayout. How I can do this thing? I have tried several ways but still can not solve this problem.

my activity_mail.xml:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 
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"
tools:context=".MainActivity">

<androidx.appcompat.widget.Toolbar
    android:id="@+id/mainToolbar"
    style="@style/mainToolbar"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <androidx.appcompat.widget.AppCompatImageView
        android:layout_width="140dp"
        android:layout_height="35dp"
        android:layout_marginStart="-20dp"
        android:src="@drawable/logo" />
</androidx.appcompat.widget.Toolbar>
<!--    TabLayout-->

<com.google.android.material.appbar.AppBarLayout
    android:id="@+id/appBarLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorAccent"
    android:elevation="10dp"
    app:layout_constraintTop_toBottomOf="@id/mainToolbar">

    <com.google.android.material.tabs.TabLayout
        android:id="@+id/mainTab"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabGravity="fill"
        android:elevation="10dp"
        app:tabIndicatorAnimationDuration="1"
        app:tabIndicatorColor="@color/colorPrimary"
        app:tabIndicatorFullWidth="true"
        app:tabIndicatorHeight="3dp"
        app:tabInlineLabel="true"
        app:tabMode="fixed"
        app:tabRippleColor="@color/colorPrimary"
        app:tabSelectedTextColor="@color/colorPrimary"
        app:tabTextAppearance="@style/customTabStyle"
        app:tabTextColor="@color/colorBlack" />
</com.google.android.material.appbar.AppBarLayout>

This problem

1 Answers1

0

In your AppBarLayout add a 0dp elevation

<com.google.android.material.appbar.AppBarLayout
    android:id="@+id/appBarLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorAccent"
    android:elevation="0dp"
Zain
  • 37,492
  • 7
  • 60
  • 84