[英]How can I assign a separate class for each view in a ViewFlipper?
I have a ViewFlipper that presents 3 different views. 我有一个ViewFlipper,可以呈现3种不同的视图。
Is it possible to have 3 classes manage* the 3 different views? 是否可以让3个类管理3个不同的视图? If so, how do I go about doing this?
如果是这样,我该怎么做?
Why don't you make your News
and Prices
class contain all of your application logic as you said. 您为什么不让
News
and Prices
类包含您所说的所有应用程序逻辑。 If you make them extend ListView
you can then add them to your ViewFlipper
and treat them in the same way, but they will have the specific behaviour as dictated by whatever you put in the News
and Prices
classes. 如果使它们扩展
ListView
,则可以将它们添加到ViewFlipper
并以相同的方式处理它们,但是它们将具有特定的行为,具体取决于您在News
和Prices
类中放置的内容。
Alternatively, just set a different listView.setAdapter()
[to populate], and listView.setOnItemSelectedListener()
[to alter behaviour] for each ListView you have in your ViewFlipper. 另外,只需为ViewFlipper中的每个ListView设置一个不同的
listView.setAdapter()
来填充,并设置listView.setOnItemSelectedListener()
来改变行为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.