0

How do I remove the boundary between action and toolbar?

Bad Case

enter image description here

Good Case, I want to like it.

enter image description here

Activity XML

enter image description here

Fragment XML

enter image description here

haha
  • 451
  • 1
  • 4
  • 10

1 Answers1

0

What you are looking for is a way to remove the shadow under toolbar.

For android 4.4 or below, you will have to set the window content overlay in your activity theme like this

<style name="Theme.MyApp" parent="Theme.AppCompat.Light.NoActionBar">
    ...
    <!--To hide shadow effect in toolbar for Android 4.4 or below-->
    <item name="android:windowContentOverlay">@null</item>
</style>

For Android 5.0+, you will also need to set the toolbar elevation to 0 in the activity layout like this.

<LinearLayout
    xmlns:app="http://schemas.android.com/apk/res-auto"
    ...
    >

    <android.support.design.widget.AppBarLayout
        ...
        app:elevation="0dp">

        ...

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

</LinearLayout>

Actually, many people ask about this. See answer here

Try to search for existing answer next time ;)

Community
  • 1
  • 1
OnJohn
  • 338
  • 2
  • 9
  • This issue is not resolved in your way. I've tried the following: Add code (getSupportActionBar().setElevation(0);) in activity oncreate, And, Add style and elevation in Fragment Xml . – haha Dec 07 '15 at 06:49
  • how about the style? did you try to set window content overlay as null in your activity style? The fix for 4.4 below may help also on Android 5.0+ too. – OnJohn Dec 07 '15 at 15:18