ShowNext
This is just a matter of calling on the , like you can on any class.
The result is a trivial activity: click the button, and the next in sequence is displayed, wrapping around to the first after viewing the last (see Figures 10‑9 and 10‑10).
Figure 10‑9. The Flipper1 application, showing the first panel
Figure 10‑10. The same application, after switching to the second panel
This, of course, could be handled more simply by having a single and changing the text and color on each click. However, you can imagine that the contents could be much more complicated, like the contents you might put into a .
As with the , sometimes, your contents may not be known at compile time. As with , though, you can add new contents on the fly with ease.
For example, let’s look at another sample activity (), using this layout:
Notice that the has no contents at compile time. Also note that there is no for flipping between the contents – more on this in a moment.
For the contents, we will create large widgets, each containing one of a set of random words. And, we will set up the to automatically rotate between the widgets, using an animation for transition:
Дата добавления: 2015-05-16; просмотров: 732;