问题描述
我有一个ViewFlipper实现,需要改进。这ViewFlipper有三个孩子的意见。基本上,我想一个指标上子视图是当前活动。我ViewFlipper是一个复杂的布局也有列表视图,只是一部分等。
I have a ViewFlipper implementation that needs to be improved. This ViewFlipper has three child views. Basically, I want an indicator on which child view is currently active. My ViewFlipper is just a part of a complex layout which also has list views, etc.
的意见交换也是自动的,在指定的时间间隔进行。
Switching of views is also automatic and done in a specified interval.
这是Android的SDK参考,我还没有看到任何监听器当ViewFlipper改变子视图。
From Android's SDK reference, I haven't seen any listener for when the ViewFlipper changes the child view.
难道你们知道的方法可以让我有一个侦听该事件?
Do you guys know of a way I can have a listener for that event?
或者是我可以实现这个功能有其他方法除了使用ViewFlipper?
Or are there alternative ways I can implement this feature besides using ViewFlipper ?
谢谢!
推荐答案
如果您应用动画(出或动画)的视图切换,您可以设置侦听器,以动画,例如,行为上的动画结束。
If you apply animation (out or in animation) on view switching, you can set listener to an animation and, for example, act on animation end.
viewFlipper.getInAnimation().setAnimationListener(new Animation.AnimationListener() {
public void onAnimationStart(Animation animation) {}
public void onAnimationRepeat(Animation animation) {}
public void onAnimationEnd(Animation animation) {}
});
这篇关于监听器ViewFlipper部件翻转事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!