Remove shadow between Actionbar and Tab
Asked Answered
D

6

6

My app is using an own style which I made with the Android Action Bar Style Generator (Style compatibility = AppCombat). The color of the Actionbar and the tab are the same but the problem is that there is a shadow between them. How can I remove this shadow?

<style name="MyAppTheme" parent="android:Theme.Holo.Light">
<item name="android:windowContentOverlay">@null</item>

"android:windowContentOverlay" is removing the shadow below the tab and not above. enter image description here

Dotson answered 17/8, 2014 at 18:58 Comment(2)
In the future, please attach the image to the question so that we can see what you're talking about. I'm having a similar dilemma, and I would have liked to see the image you were talking about.Biographical
@ChaseFlorell I'm sorry, I've added the image :)Dotson
D
4

Ok here's the solution by Audren Teissier which worked for me:

It's because you are using a drawable instead of a color.look for something like this:

<style name="MyActionBar"
parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/yourcolor</item>
</style>

Replace the drawable by a color like above and it should go away.

Dotson answered 18/8, 2014 at 10:54 Comment(1)
when i set this as background my whole activity is colored.Stibine
M
2

Use the below property in your AppBarLayout

app:elevation="0dp"
Miramirabeau answered 13/12, 2017 at 17:13 Comment(0)
D
1

Use the below code in your fragment

 getSupportActionBar().setElevation(0);
Detrital answered 13/4, 2016 at 7:18 Comment(0)
B
0

The shadow on the status bar is system set and cannot be removed, however the status bar that you are referring to is inside of Theme.Holo.Light. To my knowledge it cannot be removed.

Brassard answered 17/8, 2014 at 20:9 Comment(1)
I do not mean the statusbar shadow. That shadow is above the actionbar. i mean the shadow below the actionbar. The shadow which is between the actionbar and a tab.Dotson
D
0

Hope I have understood your question correctly, that is you want to in a way merge the action bar with the tabs so there is no border in between -> the line or shadow you mentioned. If that is correct, then this is what you are looking for:

Add this to your MyAppTheme:

<item name="android:actionBarStyle">@style/LineRemover</item>

and change this line:

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

to this:

<item name="android:windowActionBarOverlay">true</item>

and then add the following style below:

<style name="LineRemover" parent="android:Widget.Holo.ActionBar">
    <item name="android:background">@android:color/transparent</item>
</style>

In the end you have something like this:

<style name="MyAppTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:windowActionBarOverlay">true</item>
    <item name="android:actionBarStyle">@style/LineRemover</item>
</style>

<style name="LineRemover" parent="android:Widget.Holo.ActionBar">
    <item name="android:background">@android:color/transparent</item>
</style>

I guess you are aware that you have to register your theme in the android manifest (within your activity or application tags:

  android:theme="@style/MyAppTheme" >
Delsiedelsman answered 17/8, 2014 at 21:16 Comment(2)
Sorry no it doesn't work. I added a link in the question for better understandingDotson
@Mete Read through my answer again, I have added further information ... let me know if it works for you :) If it still doesn't work after these changes, try changing your parent within the MyAppTheme <style> from Theme.Holo.Light to Theme.HoloDelsiedelsman
E
0

if you set the tab layout elevation Remove.its working fine

Electrometallurgy answered 8/10, 2015 at 13:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.