如何获取附加到动画的视图?
这是一个伪代码
1. View myView = new View();
2. Animation myAnimation = new Animation();
3. myView.startAnimation(myAnimation); // animation attached to the view
4. View myViewCopy = myAnimation.getAttachedView()
,有什么方法可以实现第 4 行中的步骤吗?
here is a pseudoCode
1. View myView = new View();
2. Animation myAnimation = new Animation();
3. myView.startAnimation(myAnimation); // animation attached to the view
4. View myViewCopy = myAnimation.getAttachedView()
is there any way I can achieve the step in line number 4?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不明显。您可以编写自己的类来扩展 View 和 Animation,重写 View.startAnimation() 方法以包含传递给动画的视图副本,并向动画类添加 getAttachedView 方法?
Not obviously. You could write your own classes that extend View and Animation, override the
View.startAnimation()
method to include a copy of the view that gets passed to the animation, and add a getAttachedView method to the animation class?不会。
startAnimation
不会传递任何对动画的引用,因此动画没有有关视图的信息。No.
startAnimation
does not pass any reference to the animation, so the animation doesn't have this information about the view.