什么是启动一个活动的布局呈现后直接动画中的最佳做法? [英] What is the best practice to start an animation directly after the layout of an Activity was rendered?

查看:121
本文介绍了什么是启动一个活动的布局呈现后直接动画中的最佳做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一个最佳实践模式,它可以帮助我有以下问题。

I'm looking for a best practice pattern which helps me with the following problem.

我想尽快作为一个活动的布局得到了渲染到屏幕上开始的动画。由于我的动画取决于在布局​​视图的原始宽度和高度,我要开始动画onResume一段时间后()已经完成,所以我可以检索以prepare动画的高度和widht。

I want to start an animation as soon as the layout of an Activity got rendered to the screen. As my animation depends of the original width and height of a View in the layout I have to start the animation some time after onResume() has finished, so I could retrieve the height and widht of the view to prepare the animation.

但我想知道如何触发动画的布局呈现后?有我可以挂接到任何事件?什么是这个问题的最佳做法是什么?

But I'm wondering how to trigger the animation after the layout was rendered? Are there any events I could hook into? What is the best practice for this problem?

推荐答案

<一个href=\"http://developer.android.com/reference/android/view/ViewTreeObserver.OnGlobalLayoutListener.html\"相对=nofollow> ViewTreeObserver.OnGlobalLayoutListener 应该有所帮助。此外 ViewTreeObserver.On preDrawListener

我不得不处理这个code Android的滑动菜单这个问题-demo

I had to deal with this problem in this code android-sliding-menu-demo.

这篇关于什么是启动一个活动的布局呈现后直接动画中的最佳做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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