How to preview contents of TabWidget in graphical designer

2.5k Views Asked by At

I am developing an application for Android (2.2) in Eclipse.

My App has a TabWidget, within this 5 tabs.

TabHost: (tab1) (tab2) (tab3) (tab4) (tab5)

Beneath the Tabs is the content of the tabs (just simple elements, like Buttons, texts and so on).

In the Outline-Window I can see the "tabcontent", along with my frames inside. The Tab is also working correctly in the app, when I click it in the COMPILED app, the apropriate tab shows.

My question is now:

How can I make the graphical designer to show me the sub-tabs along with their content?

If I open the designer, I see the tabhost with my first screen, but when I try to click the tabs in the designer, It does not show me the other tab-contents (tab 2-5).

The layouts for the tabs are static,IN the XMl-File, so the designer "sees" them in the Outline>>TabContent - Window.

Like, in tab 5 there is the text "this app was programmed by", and I would like to preview this in the designer and be able to edit the text / layout there.

Is there any Hotkey perhaps? Or Menu-Option? (clicking on the TabWidget gets me the properties of the TabWidget, bit there seems no option to show any other tab than the first one)

2

There are 2 best solutions below

0
On

I could be wrong, but I don't think it's possible. The graphic layout editor is pretty limited. You are better off writing the xml and then testing on an emulator or physical device.

2
On

After playing around in Eclipse I found a way to preview what's in a tab visually using the "Graphical Layout" tab of the xml file.

  1. Open the graphical layout editor (not xml text)
  2. Open your "Outline" view in Eclipse
  3. Expand tabhost, to get to tabcontent
  4. Select the tab you wish to view/edit
  5. Drag the tab so it becomes the first element right under tabcontent
  6. Your view should update to show that tabs elements
  7. After you finish editing, just re-order everything the way you wanted

This does not remove the requirement of properly configuring your tabs in your activity/java files when you want to run your app in the simulator or on a device.