What is the difference between ViewFlipper and ViewSwitcher

They both inherit ViewAnimator . I know that ViewSwitcher allows only two views, and ViewFlipper more. But why did Android create a ViewSwitcher if it is just a ViewFlipper with two views? Are there any other differences? On what condition will one superior other be used?

+79
android
Aug 22 '10 at 16:37
source share
4 answers

From what I can say, ViewSwitcher is used if you want to switch between the two views, as you said. It is useful if you have 2 species that you need to regularly and regularly return back and forth. And the class implements ViewFactory if you want to use it.

However, ViewFlipper can be used if you want to periodically change views. Say it like an automatic leafing book. Although the custom adapter gallery is much better.

And yes, that’s all. They really are not much more useful than ViewAnimator. Why Android development does something mysterious to me.

I usually just prefer to use ViewAnimator because it gives you more freedom and therefore flexibility in the way you develop. But if you need features like ViewFactory, and you only have 2 views, use ViewSwitcher. If you want to be able to periodically change views, use ViewFlipper. If you do not need to use ViewAnimator.

+75
Aug 23 2018-10-10T00:
source share

ViewFlipper supports more than two types, ViewSwitcher supports only 2.

+15
Sep 20
source share

I'm not sure if there are any big differences between them, but from what I understand, the difference is that ViewSwitcher is used in circumstances where the view is the same, but the data is different - like in the calendar application - we ' just changing the data in the view.

+7
May 2 '11 at 20:53
source share

ViewFlipper is allowed in application widgets, but ViewSwitcher is not.

https://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout

0
Dec 11 '15 at 20:05
source share



All Articles