15

I'm implementing the Material Design bottom sheet design pattern in my app using a custom subclass of Dialog. The dialog is gravitated to the bottom of the screen and uses an y-translation window enter animation:

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:interpolator/decelerate_cubic">
    <translate android:fromYDelta="100%"
        android:toYDelta="0"
        android:duration="250" />
</set>

On earlier versions of Android, this looks great (if I say so myself): the dialog smoothly slides in from the bottom of the screen and from under the navigation bar.

However, on the latest 5.0 preview image, window animations happen on top of the navigation bar, so the dialog contents temporarily overlap the navigation. With this particular use case it looks ugly, strange and distracting.

Is there anything I can set in my theme or code to prevent this?

Navdeep Soni
  • 449
  • 4
  • 15
Veeti
  • 5,270
  • 3
  • 31
  • 37

2 Answers2

4

Just use

<item name="android:windowDrawsSystemBarBackgrounds">false</item>

for activity where you show your dialog. In this case your dialog will be under navigation bar during animation.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Alex Perevozchykov
  • 2,211
  • 22
  • 19
  • 4
    It fixes the issue, however status bar is not translucent when using above flag. – Oleksii Shliama Nov 18 '16 at 14:26
  • With this, the Bottom Sheet animation still appears to overlap the soft navigation bar, but not as evident as it does by default. Is there a way to make it exit the view completely underneath the soft navigation bar? – Ivan Jun 08 '18 at 16:49
  • Disregard my previous comment. This works if the animation duration is slowed down to more than 1.5 seconds. Would like it to work for any animation duration though. – Ivan Jun 11 '18 at 16:10
-4

From the android developers website:

In this release, Android introduces a new Toolbar widget. This is a generalization of the Action Bar pattern that gives you much more control and flexibility. Toolbar is a view in your hierarchy just like any other, making it easier to interleave with the rest of your views, animate it, and react to scroll events. You can also set it as your Activity’s action bar, meaning that your standard options menu actions will be display within it.

So the actionbar is now a view in your layout, that's why the popup goes over it. I also know they introduced some z-index properties, it might be helpful for you.

MineConsulting SRL
  • 2,340
  • 2
  • 17
  • 32
  • 1
    I am not talking about the action bar, but the device navigation bar (back, home, recents). – Veeti Nov 07 '14 at 19:13