什么是ViewFlipper和ViewSwitcher之间的区别 [英] What's the difference between ViewFlipper and ViewSwitcher

查看:904
本文介绍了什么是ViewFlipper和ViewSwitcher之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

他们都继承ViewAnimator。我知道ViewSwitcher只允许两种观点,而ViewFlipper允许更多。但为什么Android的创建ViewSwitcher如果它仅仅是一个与2次ViewFlipper?有没有其他的区别?什么情况下会令使用其中一个比另一个优越?

They both inherits ViewAnimator. I know that ViewSwitcher allows only two views, while ViewFlipper allows more. But why did Android create ViewSwitcher if it is just a ViewFlipper with 2 views? Is there any other differences? What condition will make using one superior than the other?

推荐答案

从我可以告诉,ViewSwitcher是,如果你想在两个视图像你说的使用。有用的,如果你有2次,你必须来回走相当定期。而类实现的ViewFactory,如果你想使用它。

From what I can tell, ViewSwitcher is used if you want to between two view like you said. Useful if you have 2 Views that you have to go back and forth fairly regularly. And the class implements a ViewFactory if you wish to use it.

不过,ViewFlipper可如果要定期更改视图使用。说喜欢某种类型的自动翻转书。虽然自定义适配器画廊是在这个好多了。

However, ViewFlipper can be used if you want to periodically change the views. Say like an automated flipping book of some sort. Though a custom-adapter gallery is much better at this.

和是的,这就是全部。他们真的没有那么比ViewAnimator有用得多。为什么Android开发作出任何事情真的是一个谜给我。

And yep, that's all. They really aren't that much more useful than the ViewAnimator. Why Android development makes anything is really a mystery to me.

我通常只使用ViewAnimator,因为它可以让你在你如何设计更多的自由和灵活性,因此preFER。但如果你想喜欢的ViewFactory功能,你只得到了2次使用ViewSwitcher。如果你希望能够定期更改视图使用ViewFlipper。如果你不需要任何使用ViewAnimator。

I would normally just prefer using a ViewAnimator because it gives you more freedom and thus flexibility in how you design. But if you want features like the ViewFactory and you only got 2 views use the ViewSwitcher. If you want to be able to periodically change views use ViewFlipper. If you don't need either use a ViewAnimator.

这篇关于什么是ViewFlipper和ViewSwitcher之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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