Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get rid of ActionBar shadow over SlidingTabLayout

I'm porting my app to appcompat21, using SlidingTabLayout for tabs in an ActionBarActivity. The Action bar is casting a shadow over the tab strip, and I can't figure out how to get rid of it:enter image description here

Here's what I have:

 <style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
     <item name="background">@color/app_primary</item>
     <item name="android:background">@color/app_primary</item>
     <item name="backgroundSplit">@color/black</item>
     <item name="android:backgroundSplit">@color/black</item>
     <item name="android:elevation">0dp</item>
 </style>

I've also tried

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

I got the shadow under the tab bar by setting its elevation in the layout file, but now I have two shadows... Any idea how to fix this?

like image 468
Brad Avatar asked Mar 24 '15 19:03

Brad


3 Answers

For some reason, this did not work for as well:

<item name="android:elevation">0dp</item>

and:

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

I am currently using, for ActionBar:

this.getSupportActionBar().setElevation(0);
like image 179
Jared Burrows Avatar answered Nov 05 '22 14:11

Jared Burrows


When working with "Elevation", objects can be different elevations from one another, giving shadows to anything underneath them.

If you set your toolbar and the tabs layout the same elevation it will fix the issue.

like image 44
DJTN Avatar answered Nov 05 '22 14:11

DJTN


Add app:elevation="0dp" on .support.design.widget.AppBarLayout. This will solve the issue.

like image 1
Harshit Pethani Avatar answered Nov 05 '22 14:11

Harshit Pethani