NewTabSpec
SetContent new TabContentFactory
Public createTabContent
Return new AnalogClock this
SetIndicator
AddTab
In our button’s callback, we create a object and give it an anonymous . The factory, in turn, returns the to be used for the tab – in this case, just an . The logic for constructing the tab’s View could be much more elaborate, such as using to construct a view from layout XML.
In Figure 10‑7 you can see that initially, when the activity is launched, we just have the one tab whereas Figure 10‑8 shows multiple tabs.
Figure 10‑7. The DynamicTab application, with the single initial tab
Figure 10‑8. The DynamicTab application, with three dynamically‑created tabs
Дата добавления: 2015-05-16; просмотров: 710;