可以直接跳到ViewAnimator中的第二个视图

编程入门 行业动态 更新时间:2024-10-26 22:19:15
本文介绍了可以直接跳到ViewAnimator中的第二个视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个ViewAnimator(准确地说是ViewSwitcher),它带有淡入淡出动画,还有两个Views,我可以在两个Views之间使用ViewAnimator.showNext()和ViewAnimator.showPrevious()方法进行过渡.

I have a ViewAnimator (ViewSwitcher to be precise) with fade in/out animations associated to it and two Views which I transition between using the ViewAnimator.showNext() and ViewAnimator.showPrevious() methods.

我的应用程序中有一个要求,有时我需要直接从第二个View开始,而在从第一个View到第二个View时不显示淡入淡出的动画.有人知道是否有一种简单的方法可以完成此任务,而不必弄乱与我的ViewAnimator相关的输入/输出动画吗?

There is a requirement in my app where sometimes I need to start straight from the second View, without showing a fade animation in going from the first View to the second. Anyone know if there is a straightforward way to accomplish this without having to mess around with the in/out animations associated to my ViewAnimator?

注意::我尝试调用ViewAnimator.setDisplayedChild(1),但这也可以为过渡设置动画效果.

Note: I have tried calling ViewAnimator.setDisplayedChild(1) but that also animates the transition.

推荐答案

我环顾四周,等待响应,但我猜不可能.因此,在没有更好的解决方案的情况下,当您想直接跳转到ViewAnimator的特定子View时,请将ViewAnimator的输入/输出动画设置为null,如下所示:

I looked around and waited for a response but I'm guessing it's not possible. So, in the absence of a better solution, set your ViewAnimator's in/out animations to null when you want to jump straight to a particular child View of your ViewAnimator, as follows:

myViewAnimator.setInAnimation(null); myViewAnimator.setOutAnimation(null); myViewAnimator.setDisplayedChild(childIndex);

如果有人知道更好的方法-而不是玩ViewAnimator的输入/输出动画-请分享!

If anyone knows a better way - rather than playing with the ViewAnimator's in/out animations - please share!

更多推荐

可以直接跳到ViewAnimator中的第二个视图

本文发布于:2023-07-29 08:23:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1239040.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:第二个   可以直接   视图   跳到   ViewAnimator

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!