Android 如何降低BottomSheetDialogFragment的进入和退出动画速度?
我不确定是否可以使用setEnterTransition()和setExitTransition()方法实现这一点。我想我得到了答案: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
我可以使用
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>
如果您在这里展示您的示例会更好。