Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Window animation overlaps navigation bar on Android 5.0

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?

like image 391
Veeti Avatar asked Oct 29 '14 06:10

Veeti


1 Answers

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.

like image 57
Alex Perevozchykov Avatar answered Nov 13 '22 16:11

Alex Perevozchykov