窗口动画与Android 5.0上的导航栏重叠 [英] Window animation overlaps navigation bar on Android 5.0

查看:196
本文介绍了窗口动画与Android 5.0上的导航栏重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下方法在我的应用程序中实现Material Design 底部工作表设计模式Dialog的自定义子类.该对话框位于屏幕底部,并使用y平移窗口输入动画:

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>

在早期版本的Android上,这看起来很棒(如果我自己这么说的话):对话框从屏幕底部和导航栏的下方顺滑地滑入.

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.

但是,在最新的5.0预览图像上,窗口动画发生在导航栏的顶部上,因此对话框内容暂时与导航重叠.在这个特殊的用例中,它看起来丑陋,陌生和分散注意力.

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?

推荐答案

只需使用 <item name="android:windowDrawsSystemBarBackgrounds">false</item>用于显示对话框的活动.在这种情况下,您的对话框将在动画过程中位于导航栏下方.

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.

这篇关于窗口动画与Android 5.0上的导航栏重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆