Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove the shadow below TabLayout on android

I'm trying to remove the shadow below tabs while using TabLayout, which is defined in a normal layout (and not as a part of a toolbar or actionbar).

Setting theme as

<item name="android:windowContentOverlay">@null<item/>

or

<item name="windowContentOverlay">@null<item/>

didn't work.

Also, setting elevation to 0 didn't help either.

 <android.support.design.widget.TabLayout xmlns:app="http://schemas.android.com/apk/res-auto"
                android:id="@+id/sliding_tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:background="@android:color/white"
                app:backgroundTint="@android:color/transparent"
                app:tabIndicatorColor="@android:color/transparent"
                app:tabMode="scrollable"/>
like image 547
Dus Avatar asked Jul 21 '15 15:07

Dus


People also ask

How do I get rid of the shadow bar on my Android?

By default, android provides shadow for action bar. This example demonstrates How to remove shadow below the action bar. Step 1 - Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 - Add the following code to res/layout/activity_main.

How do I disable TabLayout click?

the method has slightly different on the time of its invocation, you just have to setup your tabitem to disable its click after all viewpager fragment already added.


1 Answers

I'm assuming your TabLayout is inside AppBarLayout, that shadow comes with AppBarLayout, add this app:elevation="0dp" to that widget and I believe you're good to go.

like image 121
Steve McMeen Avatar answered Sep 17 '22 18:09

Steve McMeen