Using ViewFipper in android

笑着哭i 提交于 2019-12-03 04:06:24

What I would do in your position:

  • Make my own view class that takes as parameter what is needed to get initialised with the current question
  • Implement the ViewSwitcher.ViewFactory interface in the Activity in order to build the view for the next or previous question
  • Use a ViewSwitcher widget to allow you to switch from a question to another

There are quite a lot of examples on how to use the ImageSwitcher widget (starting with this one). You just need to adapt them to a more general ViewSwitcher.

The good thing about that solution over the ViewFlipper one is that you won't have to worry about memory when your quizz has 100 questions and you need to create all 100 views corresponding to your questions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!