语言

WindowInsetsAnimation.Callback.OnPrepare(WindowInsetsAnimation) 方法

定义

当一个内嵌动画即将开始,在视图布局为动画的结束状态之前调用。

[Android.Runtime.Register("onPrepare", "(Landroid/view/WindowInsetsAnimation;)V", "GetOnPrepare_Landroid_view_WindowInsetsAnimation_Handler", ApiSince=30)]
public virtual void OnPrepare(Android.Views.WindowInsetsAnimation animation);
[<Android.Runtime.Register("onPrepare", "(Landroid/view/WindowInsetsAnimation;)V", "GetOnPrepare_Landroid_view_WindowInsetsAnimation_Handler", ApiSince=30)>]
abstract member OnPrepare : Android.Views.WindowInsetsAnimation -> unit
override this.OnPrepare : Android.Views.WindowInsetsAnimation -> unit

参数

animation
WindowInsetsAnimation

即将开始的动画。

特性

注解

当一个内嵌动画即将开始,在视图布局为动画的结束状态之前调用。 在内嵌动画期间事件的顺序如下:

<ul li>Application callsWindowInsetsController#hide(int), WindowInsetsController#show(int)<WindowInsetsController#controlWindowInsetsAnimation/li<>>onPrepare is called on the view hierarchy< listeners<>/li liView#onApplyWindowInsets> will will be called with the end state of the end state of the animation</li<><>>li View hierarchy is laid outed, the application has requested due to the new inseted</li><is#onStart> called before the view hierarchy is drawn in the new laid out state</li><使用动画开始状态<后立即调用 li#onProgress>/li><此>帧被绘制。</li></ul>

此排序允许应用程序在动画完成后检查结束状态,然后使用布局后视图属性(如#onProgress和相关方法)恢复到第一个View#setX回调中动画的起始状态。

请注意,在调度之前 #onStart ,动画可能会被取消。 在 android.os.Build.VERSION_CODES#S S 以后, #onEnd 将立即调度,在这种情况下,不会 #onStart 发送。 打开 android.os.Build.VERSION_CODES#R R后,不会为此类动画调度 #onPrepare 回调。

注意:如果动画是由使用WindowInsetsController#controlWindowInsetsAnimation控制的应用程序,则动画的结束状态未定义,因为应用程序只能在调用shown时传入WindowInsetsAnimationController#finish参数来决定结束状态。 在这种情况下,系统会在动画启动之前以相反的可见性状态调度内嵌。 示例:使用和输入法控制输入法WindowInsetsController#controlWindowInsetsAnimation当前显示时,View#onApplyWindowInsets将收到一个WindowInsets将返回WindowInsets#isVisible的falseWindowInsets.Type#ime实例。

Java文档android.view.WindowInsetsAnimation.Callback.onPrepare(android.view.WindowInsetsAnimation)。

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于