Vinicius Pacheco
Vinicius Pacheco

Reputation: 21

Remove Tabs layout's shadow in android. API >= 21

I wanna remove this shadow from the TabLayout, but in api 21 nothing is working. I've tried defining windowContentOverlay to @null or elevation to 0dp or @null, but not seems to work.

Could someone help me?

https://i.sstatic.net/Qh7ml.png Heres is a screenschot.

<android.support.design.widget.CoordinatorLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 android:layout_width="match_parent"
 android:layout_height="match_parent">


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

<android.support.design.widget.TabLayout
    android:id="@+id/tabs"
    android:layout_width="match_parent"
    style="@style/tabs"
    android:layout_height="wrap_content"
    app:layout_scrollFlags="scroll|enterAlways"/>

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

<android.support.v4.view.ViewPager
 android:id="@+id/viewpager"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 app:layout_behavior="@string/appbar_scrolling_view_behavior" />

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

Upvotes: 1

Views: 750

Answers (2)

n00bmind
n00bmind

Reputation: 404

Set app:elevation="0dp" in your AppBarLayout (maybe in the TabLayout too..)

Upvotes: 0

Vikram
Vikram

Reputation: 1092

I am facing same problem and windowContentOverlay to @null also not worked for me. But when I changed android.support.design.widget.CoordinatorLayout and android.support.design.widget.AppBarLayout to LinearLayout it worked for me and bottom shadow of tablayout get removed.

I was tried with custom styles for android.support.design.widget.CoordinatorLayout and android.support.design.widget.AppBarLayout but did not get any success.

For now I keeping it in LinearLayout to remove bottom shadow.

Upvotes: 2

Related Questions