Search code examples
androidandroid-actionbarmaterial-designandroid-toolbar

Hiding elevation of AppBar


I am trying to simulate a large AppBar that is adding some extra layout to it.

For this, I place a layout just below the AppBar and assign the same color to it, but I get the elevation shadow as you can see in this picture:

enter image description here

I tried to configure a 4dp elevation for my layout (I tried with 8dp also) to avoid the shadow, but it doesnt dissappear.

How can I make that shadow go to simulate a big AppBar?


Solution

  • Try this:

    ActionBar actionBar = getSupportActionBar();
    actionBar.setElevation(0f);
    

    Or You can make Your own view and use it as action bar like in this answer:

    https://stackoverflow.com/a/15519711/5343907