I'm using Android Studio for programming. Target SDK is 23 and Minimum SDK is 15
I'm trying to remove the shadow between my actionbar and my sliding tab layout. But I'm not able to.
Note : The shadow is only visible in Android 5 and upper.
I have used <item name="elevation">0dp</item>
and getSupportActionBar().setElevation(0);
But still it doesn't work...
My Style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light">
<item name="elevation">0dp</item>
</style>
My Style V21
<resources>>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
My MainActivity.java onCreateCode:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setElevation(0);
....
You're missing the prefix in your style.
That said you could also set it directly on your
AppBarLayout
Or what I like to do is move the
SlidingTabLayout
into theAppBarLayout
so the shadow appears below it:Try adding setting the elevation to 0 with the help of the support library