Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何降低BottomSheetDialogFragment的进入和退出动画速度?_Android_Material Design_Bottom Sheet - Fatal编程技术网

Android 如何降低BottomSheetDialogFragment的进入和退出动画速度?

Android 如何降低BottomSheetDialogFragment的进入和退出动画速度?,android,material-design,bottom-sheet,Android,Material Design,Bottom Sheet,我不确定是否可以使用setEnterTransition()和setExitTransition()方法实现这一点。我想我得到了答案: 我可以使用getDialog().getWindow().setWindowAnimations()方法来实现同样的效果。我使用StyleAnimation解决了这个问题 @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActiv

我不确定是否可以使用setEnterTransition()setExitTransition()方法实现这一点。

我想我得到了答案:


我可以使用
getDialog().getWindow().setWindowAnimations()
方法来实现同样的效果。

我使用StyleAnimation解决了这个问题

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (getDialog() != null && getDialog().getWindow() != null)
        getDialog().getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;
}
slide_in.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
    android:fromYDelta="100%p"
    android:toYDelta="0"
    android:duration="3000"/> <!--Define duration here-->
</set>

slide_out.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
    android:fromYDelta="0"
    android:toYDelta="100%p"
    android:duration="5000"/> <!--Define duration here-->
</set>

如果您在这里展示您的示例会更好。