문제

I need to add more than two views to my viewSwitcher. I tried but I get following error log:

Can't add more than 2 views to a viewSwitcher

I would like to know if I can fix this problem by any property of the ViewSwitcher even if I manually add more views from my Java class.

Thanks!

도움이 되었습니까?

해결책

By using ViewSwitcher, this is not possible.

The Android documentation states:

Class Overview

ViewAnimator that switches between two views, and has a factory from which these views are created. You can either use the factory to create the views, or add them yourself. A ViewSwitcher can only have two child views, of which only one is shown at a time.

다른 팁

On a side note, you can use ViewFlipper, which can contain more than one view

ViewPager is also a good alternative. You can switch between multiple views by swiping.

Here on this link you can find detailed description:

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top